组件js
Component({
properties: {
// 传值从调用的组件传值过来
show: {
type: Boolean, // type 类型
value: false // 默认类型
},
title: {
type: String, // type 类型
value: "具体内容" // 默认类型
},
},
// 在组件需要方法的时候
methods: {
_noSure() {
this.triggerEvent("noSure")
},
_sure() {
this.triggerEvent("sure")
},
showsFalse() {
this.setData({
show: false
})
},
no() {
}
}
})
组件json
{
"component": true
}
使用组件
<alert-select title='{{showTitle}}' bindnoSure='noSure' bindsure='sure' show='{{show}}'>
</alert-select>
引用
"usingComponents": {
"x-scroll-view": "/components/x-scroll-view/index",
"alert-select": "/components/alert-select/index"
},
网友评论