微信小程序报错 Error: Behaviors should be constructed with Behavior()
报错详情:
VM5982:1458 页面【compenents/test1/test1]错误:
Error: Behaviors should be constructed with Behavior()
at Me (WASubContext.js?t=wechat&s=1681017978566&v=2.11.3:2)
at ze (WASubContext.js?t=wechat&s=1681017978566&v=2.11.3:2)
at Module.t (WASubContext.js?t=wechat&s=1681017978566&v=2.11.3:2)
at yt (WASubContext.js?t=wechat&s=1681017978566&v=2.11.3:2)
at Kt (WASubContext.js?t=wechat&s=1681017978566&v=2.11.3:2)
at test1.js? [sm]:6
at C (wxmodule.patch.js?t=wechat&s=1681017978566&v=2.11.3:1)
at <anonymous>:1455:7
at doWhenAllScriptLoaded (<anonymous>:1532:21)
at Object.scriptLoaded (<anonymous>:1560:5)(env: Windows,mp,1.06.2303220; lib: 2.11.3)
原来的代码
import {
storeBindingBehavior } from 'mobx-miniprogram-bindings';
import {
store} from '../../store/store';
Component({
// 实现绑定
behaviors: [storeBindingBehavior],
storeBindings: {
store,
// 字段
fields: {
num1: 'num1',
num2: 'num2',
sum: 'sum'
},
// 方法
actions: {
updNum2: 'updNum2'
}
},
})
解决
- 原因
- 修改后的代码
结束!!!!!!!
你会成为你欲望的奴隶,你在放纵中,你会觉得你是自由的,其实你被奴隶了。随心所欲不逾矩。---罗翔老师
还没有评论,来说两句吧...