//index/index.html
bindtap是点击函数,点击后产生,命名格式为bindtap="sth",sth可以是任意的,由你决定
下面举例
<view bindtap="tou">投骰子
</view>
//最好不要拼音,最好是英文且一眼知悉,别学我(qvq)
//index/index.ts中
Page({
/**
* 页面的初始数据
*/
data: {
title: "",//作为标题
content: "",//作为内容
itemData: {},
noteList: []
},
//如果你要改变data中的数据,这时候就利用this.setData()
//这就是前面html中写的sth函数
sth:function(){
this.setData({
title:"sth",
noteList:title,
itemData:noteList
})
//如果要查看这是data中的内容变成了什么,就用console.log()
console.log(this.data.title,this.data.noteList,itemData)
//你会好奇this代表什么,这里代表ts中的page
//title:sth
//noteLIst:[sth]
//itemLIst:{[sth]}
//这里仔细观察一下,你就会知道{},[],''的区别
}
})