uniapp中checkbox复选框动态绑定数据
checkbox复选框动态绑定数据:<template><view class="box"><checkbox-group @change="checkboxChange" class="agreement_radio"><checkbox :value='checkVal' :checked="checked"/><text class="t
·
checkbox复选框动态绑定数据:
<template>
<view class="box">
<checkbox-group @change="checkboxChange" class="agreement_radio">
<checkbox :value='checkVal' :checked="checked"/>
<text class="text_left">已阅读并同意</text>
<text class="text_right">《用户注册协议》《用户隐私协议》</text><br/>
<text class="text_bottom">《用户认证协议》</text>
</checkbox-group>
</view>
</template>
<script>
export default {
data() {
return {
checkVal:'0',
checked:false
}
},
onLoad() {
// console.log('页面首次加载')
},
methods: {
checkboxChange(e){
console.log(e.detail.value,'++++');
if(e.detail.value=='0'){
this.checked = true
}else{
this.checked = false
}
}
}
}
</script>
<style>
</style>
更多推荐
已为社区贡献1条内容
所有评论(0)