Tencent / wepy

小程序组件化开发框架
https://wepyjs.gitee.io/wepy-docs/
Other
22.51k stars 3.05k forks source link

wepy页面自定义事件显示未定义 #1785

Closed qcnuo closed 5 years ago

qcnuo commented 6 years ago

// 正确示例

import wepy from 'wepy';

export default class MyComponent extends wepy.component { methods = { bindtap () { let rst = this.commonFunc(); // doSomething },

    bindinput () {
        let rst = this.commonFunc();
        // doSomething
    },
}

//正确:普通自定义方法在methods对象外声明,与methods平级
customFunction () {
    return 'sth.';
}

}

这里customFunction 会显示为定义 什么情况 ? 求解 谢谢。

qcnuo commented 6 years ago

已解决 通过 this 调用

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 因为这个 Issue 最近没有任何有效回复,所以被自动标记为了stale。 如果在未来7天依旧没有任何激活操作,那么该 Issue 将会被自动关闭。 感谢您的提问。