在未使用自定义组件时,可以正常显示,现在加入了一个自定义组件,报下面的错误
WAService.js:12 Uncaught (in promise) TypeError: Cannot read property '__route__' of undefined
at WAService.js:12
at EmitterService.js? [sm]:47
at Array.forEach (<anonymous>)
at EmitterService.emit (EmitterService.js? [sm]:46)
at Object.publishWorkContext (WorkContextService.js? [sm]:49)
at Object.<anonymous> (CheckoutService.js? [sm]:65)
at r (tslib.js? [sm]:1)
at Object.next (tslib.js? [sm]:1)
at _ (tslib.js? [sm]:1)
at <anonymous>
(anonymous) @ WAService.js:12
(anonymous) @ EmitterService.js? [sm]:47
EmitterService.emit @ EmitterService.js? [sm]:46
publishWorkContext @ WorkContextService.js? [sm]:49
(anonymous) @ CheckoutService.js? [sm]:65
r @ tslib.js? [sm]:1
(anonymous) @ tslib.js? [sm]:1
_ @ tslib.js? [sm]:1
Promise rejected (async)
i @ tslib.js? [sm]:1
(anonymous) @ tslib.js? [sm]:1
__awaiter @ tslib.js? [sm]:1
BillingAddressPage.onSelectAddress @ billingAddressPage.js? [sm]:88
(anonymous) @ WAService.js:13
a @ WAService.js:13
K @ WAService.js:13
(anonymous) @ WAService.js:13
(anonymous) @ WAService.js:13
(anonymous) @ WAService.js:6
e.(anonymous function) @ WAService.js:3
d @ appservice:1728
g.registerCallback @ appservice:1728
k.forEach @ appservice:1728
d @ appservice:1728
h.onmessage @ appservice:1728
请问是什么方法要加bind(this)呢?
你好,我没能根据你提供的代码复现问题。麻烦提供更完整的代码以方便排查。
谢谢,我也遇到这个问题了,用你的方法解决了
问题解决了:需要加个bind(this),不知道是不是基础库改了的原因,以前是不需要加xxx.bind(this),
this.handleCheckoutChanged.bind(this)
好的,我周末整理一下
如何使用wx.navigateTo报错,用wx.redirectTo不报错
Component({
properties: {
model: {
type: Object,
value: {}
},
},
data: {},
methods: {
onChooseBillingAddress(e) {
let url = PageConfig.checkoutBillingAddressPage.url;
// PageUtil.navigateTo(url);
// 报错
wx.navigateTo({
url
});
// 不报错
wx.redirectTo({
url
});
}
}
});
查了一下在子组件使用,
wx.navigateTo({
url: '另一个Page页面'
});
就报这样的错误,不知道为什么