由于小程序使用了vant-ui框架,導(dǎo)致checkbox點(diǎn)擊無法選中問題?
<van-checkbox value="{{ checked }}" shape="square">
<view class="check-content">
<view class="checktext">我已閱讀并同意>《用戶協(xié)議》《隱私政策》</view>
</view>
</van-checkbox>
記得定義checked 默認(rèn)值
?解決辦法 :添加onChange事件,給checked 做賦值操作。
<van-checkbox value="{{ checked }}" shape="square" bind:change="onChange">
<view class="check-content">
<view class="checktext">我已閱讀并同意《用戶協(xié)議》《隱私政策》</view>
</view>
</van-checkbox>
onChange(e){
this.setData({
checked: e.detail
})
},
可以打印看看console.log(e)
- 選中效果:
- 取消選中效果:?
?文章來源:http://www.zghlxwxcb.cn/news/detail-663252.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-663252.html
到了這里,關(guān)于完美解決微信小程序使用復(fù)選框van-checkbox無法選中的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!