We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
发现你的代码中使用了将page放在observer这样告成回调时this作用域会有问题,变成了{observer, selector, name}这样引用就不对了,而且没办法修改界面,所以我使改了你的代码 原来是这样 var newNotice ={ name: name, selector: selector, observer: observer }; 修改后: var newNotice = Object.assign(observer, {selector: selector}, {name: name}) /* { name: name, selector: selector, observer: observer };*/ 合并成一个对像才适用于Wepy
{observer, selector, name}
var newNotice ={ name: name, selector: selector, observer: observer };
var newNotice = Object.assign(observer, {selector: selector}, {name: name}) /* { name: name, selector: selector, observer: observer };*/
The text was updated successfully, but these errors were encountered:
wepy使用时候,this确实有问题,但是上边处理方法错误,Object.assign会让observer的监听只有一个,新添加监听会覆盖,正确做法是在原来代码上的postNotificationName方法里面的notice.selector(info);代码改为notice.selector.call(notice.observer, info);
Sorry, something went wrong.
No branches or pull requests
发现你的代码中使用了将page放在observer这样告成回调时this作用域会有问题,变成了
{observer, selector, name}
这样引用就不对了,而且没办法修改界面,所以我使改了你的代码原来是这样
var newNotice ={ name: name, selector: selector, observer: observer };
修改后:
var newNotice = Object.assign(observer, {selector: selector}, {name: name}) /* { name: name, selector: selector, observer: observer };*/
合并成一个对像才适用于Wepy
The text was updated successfully, but these errors were encountered: