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

我看出来了,但这里还是建议你自己找找,依赖心理太重了对学习编程没有任何好处。

0
0

纯正商业级微信小程序应用实战,全方位小程序特性讲解

真实数据的高质量小程序项目,学会直接工作

4791 学习 · 2133 问题

查看课程