wepy怎么在生命周期中调用methods方法

很简单:

比如在 onLoad () {

    imgRemove(e) {
        this.methods.onRemove(e)
    }

}

 

在methods中就可以直接调用属于它的方法,主要是一个属性查找问题,属于哪个元素下的方法

methods = {

    onRemove(e) {
        console.log("--"+ e +"--")
    }
    onAlert() {
      this.onRemove()
    }
    
}
posted @ 2019-07-09 17:58  爱看星星的稻草人  阅读(1228)  评论(0编辑  收藏  举报