一.自定义组件properties
自定义组件的properties是组件的属性值定义部分。
如下label就i是properties里面定义的属性值
<custom-checkbox label="我已阅读并同意 用户协议 和 隐私协议" position="right"/>
定义
Component({
/**
* 组件的属性列表
*/
properties: {
//简写
// label:String
//全写
label:{
type:String,
value:''
},
position:{
type:String,
value:'right'
}
}
)}
获取和修改值
methods: {
update(){
const label=this.properties.label
this.setData({
label:'已同意'
})
console.log(label)
}
}