组件内使用createSelectorQuery获取节点
需要in(this)
// 1
wx.createSelectorQuery().in(this)
// 2
// this.createSelectorQuery()
组件通信
// 子组件child
properties: {
name: String,
}
this.triggerEvent('onSubmit', { user: {}})
// 父组件parents
<child :name="value" bind:onSubmit="onSubmit"></child>
onSubmit({ detail }) {
console.log(detail.user)
}
数据转换成JSON
// 转
encodeURIComponent(JSON.stringify(data))
// 解
JSON.parse(decodeURIComponent(data))