组件json文件
{
"usingComponents": {},
"component": true
}
组件js文件
Component({
data: {
value: 1
},
properties:{
innreTest:{
type:'String',
value:'123123'
},
dataArr:{
type:'Array',
value:[]
}
},
methods: {
closeDialog() {
this.triggerEvent('closedialog', {})
},
chooseItem(e){
// console.log(e.currentTarget.dataset.item)
let item = e.currentTarget.dataset.item
this.triggerEvent('choose',item)
}
},
addnum() {
this.data.value ++
this.triggerEvent('addnum', {})
},
})
组件xwml文件
{{innreTest}}
取消
确定
{{item.name}}
使用组件
js data
dataArray:[{
name:'张三'
},
{
name:'李四'
}],
innreTest:'ettrytrt',
methods:{
fuchoose(e){
console.log(e.detail.name);//张三李四~~~~
},
}