日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

微信小程序radio單選按鈕選中與取消

作者:大大。 更新時間: 2023-10-16 編程語言

?

?

?wxml

<view bindtap='checkedTap'>
      <radio checked="{{checked}}">設為默認</radio>
</view>

wxss

<style lang="less" >
radio .wx-radio-input {
  border-radius: 50%; /* 圓角 */
  width: 24rpx;
  border: 2rpx solid #5e5e5f;
  height: 24rpx;
}
radio .wx-radio-input.wx-radio-input-checked {
  border: none;
  background: #c1885a;
}
radio .wx-radio-input.wx-radio-input-checked::before {
  border-radius: 50%; /* 圓角 */
  width: 28rpx; /* 選中后對勾大小,不要超過背景的尺寸 */
  height: 28rpx; /* 選中后對勾大小,不要超過背景的尺寸 */
  line-height: 28rpx;
  text-align: center;
  font-size: 20rpx; /* 對勾大小 30rpx */
  color: #fff; /* 對勾顏色 白色 */
  background: #c1885a;
  transform: translate(-50%, -50%) scale(1);
}
</style>

在點擊事件中,通過取反即可實現選中與取消。?

js?

 data: {
    checked:true
  },
  //是否選中
  checkedTap: function () {
    this.setData({
      "checked": !this.data.checked
    })
  },

原文鏈接:https://blog.csdn.net/weixin_43923808/article/details/131982167

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新