thirdScriptError this.SetData is not a function
来源:6-5 三元表达式与图片切换
zhangqinno8
2019-10-29
为什么我点击之后出现报错
// components/like.js
Component({
/**
- 组件的属性列表
*/
properties: {
like: {
type: Boolean
},
count: {
type: Number
}
},
/**
- 组件的初始数据
*/
data: {
like: true,
count: 9,
like1: ‘/components/ly4.png’,
like2: ‘/components/ly3.png’
}
/**
-
组件的方法列表
*/
methods: {
onLike: function(e) {
let like = this.properties.like
let count = this.properties.count
count = like?count-1:count+1
this.SetData({
count: count,
like:!like})
}
}
})
写回答
1回答
-
7七月
2019-10-30
我看出来了,但这里还是建议你自己找找,依赖心理太重了对学习编程没有任何好处。
00
相似问题