taro写微信小程序出错:
thirdScriptError
Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377029)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
at s (http://127.0.0.1:61854/appservice/__dev__/WAService.js:2:1377265)
console.error @ VM26:1
errorReport @ VM42 WAService.js:2
thirdErrorReport @ VM42 WAService.js:2
(anonymous) @ VM42 WAService.js:2
c @ VM42 WAService.js:2
r @ VM42 WAService.js:2
(anonymous) @ VM42 WAService.js:2
value @ VM42 WAService.js:2
(anonymous) @ VM42 WAService.js:2
scriptLoaded @ appservice?t=1584073225343:1124
script.onload @ appservice?t=1584073225343:1136
error (async)
(anonymous) @ VM42 WAService.js:2
(anonymous) @ VM42 WAService.js:2
(anonymous) @ VM42 WAService.js:2
VM42 WAService.js:2 Page "pages/index/index" has not been registered yet.
一步步地剥离新代码,终于定位到地方
export default class Index extends Component {
state = {
pic : 'http://www.qqtouxiang.com/d/file/tupian/mx/20170918/jixcmavsyr2dh.jpg'
}
componentWillMount () { }
componentDidMount () { }
componentWillUnmount () { }
componentDidShow () { }
componentDidHide () { }
config: Config = {
navigationBarTitleText: '首页'
}
render () {
const myState = this.state
return (
<View className='index'>
<Image src={myState.pic}></Image>
</View>
)
}
}
问题在这句:<Image src={myState.pic}></Image>
改成<Image src={this.state.pic}></Image>
网上也查过,感觉出现这个问题的原因不止这么一种。
作者:帅得不敢出门 https://blog.csdn.net/zmlovelx