收藏
回答

为什么组件的methods为undefined?

在组件的任何一个生命周期输出this.methods都为undefined,为什么?请问组件的methods对象什么时候初始化?

// components/c1/c1.js

Component({

properties: {

},

data: {

},

methods: {

hello: function(){

}

},

ready: function(){

console.log(this.methods)

},

attached: function(){

console.log(this.methods)

}

})

输出都是: undefined

回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签