uni-data-checkbox.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. <template>
  2. <view class="uni-data-checklist" :style="{'margin-top':isTop+'px'}">
  3. <template v-if="!isLocal">
  4. <view class="uni-data-loading">
  5. <uni-load-more v-if="!mixinDatacomErrorMessage" status="loading" iconType="snow" :iconSize="18" :content-text="contentText"></uni-load-more>
  6. <text v-else>{{mixinDatacomErrorMessage}}</text>
  7. </view>
  8. </template>
  9. <template v-else>
  10. <checkbox-group v-if="multiple" class="checklist-group" :class="{'is-list':mode==='list' || wrap}" @change="chagne">
  11. <label class="checklist-box" :class="['is--'+mode,item.selected?'is-checked':'',(disabled || !!item.disabled)?'is-disable':'',index!==0&&mode==='list'?'is-list-border':'']"
  12. :style="item.styleBackgroud" v-for="(item,index) in dataList" :key="index">
  13. <checkbox class="hidden" hidden :disabled="disabled || !!item.disabled" :value="item[map.value]+''" :checked="item.selected" />
  14. <view v-if="(mode !=='tag' && mode !== 'list') || ( mode === 'list' && icon === 'left')" class="checkbox__inner" :style="item.styleIcon">
  15. <view class="checkbox__inner-icon"></view>
  16. </view>
  17. <view class="checklist-content" :class="{'list-content':mode === 'list' && icon ==='left'}">
  18. <text class="checklist-text" :style="item.styleIconText">{{item[map.text]}}</text>
  19. <view v-if="mode === 'list' && icon === 'right'" class="checkobx__list" :style="item.styleBackgroud"></view>
  20. </view>
  21. </label>
  22. </checkbox-group>
  23. <radio-group v-else class="checklist-group" :class="{'is-list':mode==='list','is-wrap':wrap}" @change="chagne">
  24. <!-- -->
  25. <label class="checklist-box" :class="['is--'+mode,item.selected?'is-checked':'',(disabled || !!item.disabled)?'is-disable':'',index!==0&&mode==='list'?'is-list-border':'']"
  26. :style="item.styleBackgroud" v-for="(item,index) in dataList" :key="index">
  27. <radio class="hidden" hidden :disabled="disabled || item.disabled" :value="item[map.value]+''" :checked="item.selected" />
  28. <view v-if="(mode !=='tag' && mode !== 'list') || ( mode === 'list' && icon === 'left')" class="radio__inner"
  29. :style="item.styleBackgroud">
  30. <view class="radio__inner-icon" :style="item.styleIcon"></view>
  31. </view>
  32. <view class="checklist-content" :class="{'list-content':mode === 'list' && icon ==='left'}">
  33. <text class="checklist-text" :style="item.styleIconText">{{item[map.text]}}</text>
  34. <view v-if="mode === 'list' && icon === 'right'" :style="item.styleRightIcon" class="checkobx__list"></view>
  35. </view>
  36. </label>
  37. </radio-group>
  38. </template>
  39. </view>
  40. </template>
  41. <script>
  42. /**
  43. * DataChecklist 数据选择器
  44. * @description 通过数据渲染 checkbox 和 radio
  45. * @tutorial https://ext.dcloud.net.cn/plugin?id=xxx
  46. * @property {String} mode = [default| list | button | tag] 显示模式
  47. * @value default 默认横排模式
  48. * @value list 列表模式
  49. * @value button 按钮模式
  50. * @value tag 标签模式
  51. * @property {Boolean} multiple = [true|false] 是否多选
  52. * @property {Array|String|Number} value 默认值
  53. * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
  54. * @property {Number|String} min 最小选择个数 ,multiple为true时生效
  55. * @property {Number|String} max 最大选择个数 ,multiple为true时生效
  56. * @property {Boolean} wrap 是否换行显示
  57. * @property {String} icon = [left|right] list 列表模式下icon显示位置
  58. * @property {Boolean} selectedColor 选中颜色
  59. * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
  60. * @property {Boolean} selectedTextColor 选中文本颜色,如不填写则自动显示
  61. * @property {Object} map 字段映射, 默认 map={text:'text',value:'value'}
  62. * @value left 左侧显示
  63. * @value right 右侧显示
  64. * @event {Function} change 选中发生变化触发
  65. */
  66. export default {
  67. name: 'uniDataChecklist',
  68. mixins: [uniCloud.mixinDatacom || {}],
  69. emits:['input','update:modelValue','change'],
  70. props: {
  71. mode: {
  72. type: String,
  73. default: 'default'
  74. },
  75. multiple: {
  76. type: Boolean,
  77. default: false
  78. },
  79. value: {
  80. type: [Array, String, Number],
  81. default () {
  82. return ''
  83. }
  84. },
  85. // TODO vue3
  86. modelValue: {
  87. type: [Array, String, Number],
  88. default() {
  89. return '';
  90. }
  91. },
  92. localdata: {
  93. type: Array,
  94. default () {
  95. return []
  96. }
  97. },
  98. min: {
  99. type: [Number, String],
  100. default: ''
  101. },
  102. max: {
  103. type: [Number, String],
  104. default: ''
  105. },
  106. wrap: {
  107. type: Boolean,
  108. default: false
  109. },
  110. icon: {
  111. type: String,
  112. default: 'left'
  113. },
  114. selectedColor: {
  115. type: String,
  116. default: ''
  117. },
  118. selectedTextColor: {
  119. type: String,
  120. default: ''
  121. },
  122. emptyText:{
  123. type: String,
  124. default: '暂无数据'
  125. },
  126. disabled:{
  127. type: Boolean,
  128. default: false
  129. },
  130. map:{
  131. type: Object,
  132. default(){
  133. return {
  134. text:'text',
  135. value:'value'
  136. }
  137. }
  138. }
  139. },
  140. watch: {
  141. localdata: {
  142. handler(newVal) {
  143. this.range = newVal
  144. this.dataList = this.getDataList(this.getSelectedValue(newVal))
  145. },
  146. deep: true
  147. },
  148. mixinDatacomResData(newVal) {
  149. this.range = newVal
  150. this.dataList = this.getDataList(this.getSelectedValue(newVal))
  151. },
  152. value(newVal) {
  153. this.dataList = this.getDataList(newVal)
  154. // fix by mehaotian is_reset 在 uni-forms 中定义
  155. // if(!this.is_reset){
  156. // this.is_reset = false
  157. // this.formItem && this.formItem.setValue(newVal)
  158. // }
  159. },
  160. modelValue(newVal) {
  161. this.dataList = this.getDataList(newVal);
  162. // if(!this.is_reset){
  163. // this.is_reset = false
  164. // this.formItem && this.formItem.setValue(newVal)
  165. // }
  166. }
  167. },
  168. data() {
  169. return {
  170. dataList: [],
  171. range: [],
  172. contentText: {
  173. contentdown: '查看更多',
  174. contentrefresh: '加载中',
  175. contentnomore: '没有更多'
  176. },
  177. isLocal:true,
  178. styles: {
  179. selectedColor: '#2979ff',
  180. selectedTextColor: '#666',
  181. },
  182. isTop:0
  183. };
  184. },
  185. computed:{
  186. dataValue(){
  187. if(this.value === '')return this.modelValue
  188. if(this.modelValue === '') return this.value
  189. return this.value
  190. }
  191. },
  192. created() {
  193. // this.form = this.getForm('uniForms')
  194. // this.formItem = this.getForm('uniFormsItem')
  195. // this.formItem && this.formItem.setValue(this.value)
  196. // if (this.formItem) {
  197. // this.isTop = 6
  198. // if (this.formItem.name) {
  199. // // 如果存在name添加默认值,否则formData 中不存在这个字段不校验
  200. // if(!this.is_reset){
  201. // this.is_reset = false
  202. // this.formItem.setValue(this.dataValue)
  203. // }
  204. // this.rename = this.formItem.name
  205. // this.form.inputChildrens.push(this)
  206. // }
  207. // }
  208. if (this.localdata && this.localdata.length !== 0) {
  209. this.isLocal = true
  210. this.range = this.localdata
  211. this.dataList = this.getDataList(this.getSelectedValue(this.range))
  212. } else {
  213. if (this.collection) {
  214. this.isLocal = false
  215. this.loadData()
  216. }
  217. }
  218. },
  219. methods: {
  220. loadData() {
  221. this.mixinDatacomGet().then(res=>{
  222. this.mixinDatacomResData = res.result.data
  223. if(this.mixinDatacomResData.length === 0){
  224. this.isLocal = false
  225. this.mixinDatacomErrorMessage = this.emptyText
  226. }else{
  227. this.isLocal = true
  228. }
  229. }).catch(err=>{
  230. this.mixinDatacomErrorMessage = err.message
  231. })
  232. },
  233. /**
  234. * 获取父元素实例
  235. */
  236. getForm(name = 'uniForms') {
  237. let parent = this.$parent;
  238. let parentName = parent.$options.name;
  239. while (parentName !== name) {
  240. parent = parent.$parent;
  241. if (!parent) return false
  242. parentName = parent.$options.name;
  243. }
  244. return parent;
  245. },
  246. chagne(e) {
  247. const values = e.detail.value
  248. let detail = {
  249. value: [],
  250. data: []
  251. }
  252. if (this.multiple) {
  253. this.range.forEach(item => {
  254. if (values.includes(item[this.map.value] + '')) {
  255. detail.value.push(item[this.map.value])
  256. detail.data.push(item)
  257. }
  258. })
  259. } else {
  260. const range = this.range.find(item => (item[this.map.value] + '') === values)
  261. if (range) {
  262. detail = {
  263. value: range[this.map.value],
  264. data: range
  265. }
  266. }
  267. }
  268. // this.formItem && this.formItem.setValue(detail.value)
  269. // TODO 兼容 vue2
  270. this.$emit('input', detail.value);
  271. // // TOTO 兼容 vue3
  272. this.$emit('update:modelValue', detail.value);
  273. this.$emit('change', {
  274. detail
  275. })
  276. if (this.multiple) {
  277. // 如果 v-model 没有绑定 ,则走内部逻辑
  278. // if (this.value.length === 0) {
  279. this.dataList = this.getDataList(detail.value, true)
  280. // }
  281. } else {
  282. this.dataList = this.getDataList(detail.value)
  283. }
  284. },
  285. /**
  286. * 获取渲染的新数组
  287. * @param {Object} value 选中内容
  288. */
  289. getDataList(value) {
  290. // 解除引用关系,破坏原引用关系,避免污染源数据
  291. let dataList = JSON.parse(JSON.stringify(this.range))
  292. let list = []
  293. if (this.multiple) {
  294. if (!Array.isArray(value)) {
  295. value = []
  296. }
  297. }
  298. dataList.forEach((item, index) => {
  299. item.disabled = item.disable || item.disabled || false
  300. if (this.multiple) {
  301. if (value.length > 0) {
  302. let have = value.find(val => val === item[this.map.value])
  303. item.selected = have !== undefined
  304. } else {
  305. item.selected = false
  306. }
  307. } else {
  308. item.selected = value === item[this.map.value]
  309. }
  310. list.push(item)
  311. })
  312. return this.setRange(list)
  313. },
  314. /**
  315. * 处理最大最小值
  316. * @param {Object} list
  317. */
  318. setRange(list) {
  319. let selectList = list.filter(item => item.selected)
  320. let min = Number(this.min) || 0
  321. let max = Number(this.max) || ''
  322. list.forEach((item, index) => {
  323. if (this.multiple) {
  324. if (selectList.length <= min) {
  325. let have = selectList.find(val => val[this.map.value] === item[this.map.value])
  326. if (have !== undefined) {
  327. item.disabled = true
  328. }
  329. }
  330. if (selectList.length >= max && max !== '') {
  331. let have = selectList.find(val => val[this.map.value] === item[this.map.value])
  332. if (have === undefined) {
  333. item.disabled = true
  334. }
  335. }
  336. }
  337. this.setStyles(item, index)
  338. list[index] = item
  339. })
  340. return list
  341. },
  342. /**
  343. * 设置 class
  344. * @param {Object} item
  345. * @param {Object} index
  346. */
  347. setStyles(item, index) {
  348. // 设置自定义样式
  349. item.styleBackgroud = this.setStyleBackgroud(item)
  350. item.styleIcon = this.setStyleIcon(item)
  351. item.styleIconText = this.setStyleIconText(item)
  352. item.styleRightIcon = this.setStyleRightIcon(item)
  353. },
  354. /**
  355. * 获取选中值
  356. * @param {Object} range
  357. */
  358. getSelectedValue(range) {
  359. if (!this.multiple) return this.dataValue
  360. let selectedArr = []
  361. range.forEach((item) => {
  362. if (item.selected) {
  363. selectedArr.push(item[this.map.value])
  364. }
  365. })
  366. return this.dataValue.length > 0 ? this.dataValue : selectedArr
  367. },
  368. /**
  369. * 设置背景样式
  370. */
  371. setStyleBackgroud(item) {
  372. let styles = {}
  373. let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
  374. if (this.selectedColor) {
  375. if (this.mode !== 'list') {
  376. styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
  377. }
  378. if (this.mode === 'tag') {
  379. styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
  380. }
  381. }
  382. let classles = ''
  383. for (let i in styles) {
  384. classles += `${i}:${styles[i]};`
  385. }
  386. return classles
  387. },
  388. setStyleIcon(item) {
  389. let styles = {}
  390. let classles = ''
  391. if (this.selectedColor) {
  392. let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
  393. styles['background-color'] = item.selected?selectedColor:'#fff'
  394. styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
  395. if(!item.selected && item.disabled){
  396. styles['background-color'] = '#F2F6FC'
  397. styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
  398. }
  399. }
  400. for (let i in styles) {
  401. classles += `${i}:${styles[i]};`
  402. }
  403. return classles
  404. },
  405. setStyleIconText(item) {
  406. let styles = {}
  407. let classles = ''
  408. if (this.selectedColor) {
  409. let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
  410. if (this.mode === 'tag') {
  411. styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
  412. } else {
  413. styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:selectedColor):'#666'
  414. }
  415. if(!item.selected && item.disabled){
  416. styles.color = '#999'
  417. }
  418. }
  419. for (let i in styles) {
  420. classles += `${i}:${styles[i]};`
  421. }
  422. return classles
  423. },
  424. setStyleRightIcon(item) {
  425. let styles = {}
  426. let classles = ''
  427. if (this.mode === 'list') {
  428. styles['border-color'] = item.selected?this.styles.selectedColor:'#DCDFE6'
  429. }
  430. for (let i in styles) {
  431. classles += `${i}:${styles[i]};`
  432. }
  433. return classles
  434. }
  435. }
  436. }
  437. </script>
  438. <style lang="scss">
  439. $uni-primary: #2979ff !default;
  440. $border-color: #DCDFE6;
  441. $disable:0.4;
  442. @mixin flex {
  443. /* #ifndef APP-NVUE */
  444. display: flex;
  445. /* #endif */
  446. }
  447. .uni-data-loading {
  448. @include flex;
  449. flex-direction: row;
  450. justify-content: center;
  451. align-items: center;
  452. height: 36px;
  453. padding-left: 10px;
  454. color: #999;
  455. }
  456. .uni-data-checklist {
  457. position: relative;
  458. z-index: 0;
  459. flex: 1;
  460. // 多选样式
  461. .checklist-group {
  462. @include flex;
  463. flex-direction: row;
  464. flex-wrap: wrap;
  465. &.is-list {
  466. flex-direction: column;
  467. }
  468. .checklist-box {
  469. @include flex;
  470. flex-direction: row;
  471. align-items: center;
  472. position: relative;
  473. margin: 5px 0;
  474. margin-right: 25px;
  475. .hidden {
  476. position: absolute;
  477. opacity: 0;
  478. }
  479. // 文字样式
  480. .checklist-content {
  481. @include flex;
  482. flex: 1;
  483. flex-direction: row;
  484. align-items: center;
  485. justify-content: space-between;
  486. .checklist-text {
  487. font-size: 14px;
  488. color: #666;
  489. margin-left: 5px;
  490. line-height: 14px;
  491. }
  492. .checkobx__list {
  493. border-right-width: 1px;
  494. border-right-color: #007aff;
  495. border-right-style: solid;
  496. border-bottom-width:1px;
  497. border-bottom-color: #007aff;
  498. border-bottom-style: solid;
  499. height: 12px;
  500. width: 6px;
  501. left: -5px;
  502. transform-origin: center;
  503. transform: rotate(45deg);
  504. opacity: 0;
  505. }
  506. }
  507. // 多选样式
  508. .checkbox__inner {
  509. /* #ifndef APP-NVUE */
  510. flex-shrink: 0;
  511. box-sizing: border-box;
  512. /* #endif */
  513. position: relative;
  514. width: 16px;
  515. height: 16px;
  516. border: 1px solid $border-color;
  517. border-radius: 4px;
  518. background-color: #fff;
  519. z-index: 1;
  520. .checkbox__inner-icon {
  521. position: absolute;
  522. /* #ifdef APP-NVUE */
  523. top: 2px;
  524. /* #endif */
  525. /* #ifndef APP-NVUE */
  526. top: 1px;
  527. /* #endif */
  528. left: 5px;
  529. height: 8px;
  530. width: 4px;
  531. border-right-width: 1px;
  532. border-right-color: #fff;
  533. border-right-style: solid;
  534. border-bottom-width:1px ;
  535. border-bottom-color: #fff;
  536. border-bottom-style: solid;
  537. opacity: 0;
  538. transform-origin: center;
  539. transform: rotate(40deg);
  540. }
  541. }
  542. // 单选样式
  543. .radio__inner {
  544. @include flex;
  545. /* #ifndef APP-NVUE */
  546. flex-shrink: 0;
  547. box-sizing: border-box;
  548. /* #endif */
  549. justify-content: center;
  550. align-items: center;
  551. position: relative;
  552. width: 16px;
  553. height: 16px;
  554. border: 1px solid $border-color;
  555. border-radius: 16px;
  556. background-color: #fff;
  557. z-index: 1;
  558. .radio__inner-icon {
  559. width: 8px;
  560. height: 8px;
  561. border-radius: 10px;
  562. opacity: 0;
  563. }
  564. }
  565. // 默认样式
  566. &.is--default {
  567. // 禁用
  568. &.is-disable {
  569. /* #ifdef H5 */
  570. cursor: not-allowed;
  571. /* #endif */
  572. .checkbox__inner {
  573. background-color: #F2F6FC;
  574. border-color: $border-color;
  575. /* #ifdef H5 */
  576. cursor: not-allowed;
  577. /* #endif */
  578. }
  579. .radio__inner {
  580. background-color: #F2F6FC;
  581. border-color: $border-color;
  582. }
  583. .checklist-text {
  584. color: #999;
  585. }
  586. }
  587. // 选中
  588. &.is-checked {
  589. .checkbox__inner {
  590. border-color: $uni-primary;
  591. background-color: $uni-primary;
  592. .checkbox__inner-icon {
  593. opacity: 1;
  594. transform: rotate(45deg);
  595. }
  596. }
  597. .radio__inner {
  598. border-color: $uni-primary;
  599. .radio__inner-icon {
  600. opacity: 1;
  601. background-color: $uni-primary;
  602. }
  603. }
  604. .checklist-text {
  605. color: $uni-primary;
  606. }
  607. // 选中禁用
  608. &.is-disable {
  609. .checkbox__inner {
  610. opacity: $disable;
  611. }
  612. .checklist-text {
  613. opacity: $disable;
  614. }
  615. .radio__inner {
  616. opacity: $disable;
  617. }
  618. }
  619. }
  620. }
  621. // 按钮样式
  622. &.is--button {
  623. margin-right: 10px;
  624. padding: 5px 10px;
  625. border: 1px $border-color solid;
  626. border-radius: 3px;
  627. transition: border-color 0.2s;
  628. // 禁用
  629. &.is-disable {
  630. /* #ifdef H5 */
  631. cursor: not-allowed;
  632. /* #endif */
  633. border: 1px #eee solid;
  634. opacity: $disable;
  635. .checkbox__inner {
  636. background-color: #F2F6FC;
  637. border-color: $border-color;
  638. /* #ifdef H5 */
  639. cursor: not-allowed;
  640. /* #endif */
  641. }
  642. .radio__inner {
  643. background-color: #F2F6FC;
  644. border-color: $border-color;
  645. /* #ifdef H5 */
  646. cursor: not-allowed;
  647. /* #endif */
  648. }
  649. .checklist-text {
  650. color: #999;
  651. }
  652. }
  653. &.is-checked {
  654. border-color: $uni-primary;
  655. .checkbox__inner {
  656. border-color: $uni-primary;
  657. background-color: $uni-primary;
  658. .checkbox__inner-icon {
  659. opacity: 1;
  660. transform: rotate(45deg);
  661. }
  662. }
  663. .radio__inner {
  664. border-color: $uni-primary;
  665. .radio__inner-icon {
  666. opacity: 1;
  667. background-color: $uni-primary;
  668. }
  669. }
  670. .checklist-text {
  671. color: $uni-primary;
  672. }
  673. // 选中禁用
  674. &.is-disable {
  675. opacity: $disable;
  676. }
  677. }
  678. }
  679. // 标签样式
  680. &.is--tag {
  681. margin-right: 10px;
  682. padding: 5px 10px;
  683. border: 1px $border-color solid;
  684. border-radius: 3px;
  685. background-color: #f5f5f5;
  686. .checklist-text {
  687. margin: 0;
  688. color: #666;
  689. }
  690. // 禁用
  691. &.is-disable {
  692. /* #ifdef H5 */
  693. cursor: not-allowed;
  694. /* #endif */
  695. opacity: $disable;
  696. }
  697. &.is-checked {
  698. background-color: $uni-primary;
  699. border-color: $uni-primary;
  700. .checklist-text {
  701. color: #fff;
  702. }
  703. }
  704. }
  705. // 列表样式
  706. &.is--list {
  707. /* #ifndef APP-NVUE */
  708. display: flex;
  709. /* #endif */
  710. padding: 10px 15px;
  711. padding-left: 0;
  712. margin: 0;
  713. &.is-list-border {
  714. border-top: 1px #eee solid;
  715. }
  716. // 禁用
  717. &.is-disable {
  718. /* #ifdef H5 */
  719. cursor: not-allowed;
  720. /* #endif */
  721. .checkbox__inner {
  722. background-color: #F2F6FC;
  723. border-color: $border-color;
  724. /* #ifdef H5 */
  725. cursor: not-allowed;
  726. /* #endif */
  727. }
  728. .checklist-text {
  729. color: #999;
  730. }
  731. }
  732. &.is-checked {
  733. .checkbox__inner {
  734. border-color: $uni-primary;
  735. background-color: $uni-primary;
  736. .checkbox__inner-icon {
  737. opacity: 1;
  738. transform: rotate(45deg);
  739. }
  740. }
  741. .radio__inner {
  742. .radio__inner-icon {
  743. opacity: 1;
  744. }
  745. }
  746. .checklist-text {
  747. color: $uni-primary;
  748. }
  749. .checklist-content {
  750. .checkobx__list {
  751. opacity: 1;
  752. border-color: $uni-primary;
  753. }
  754. }
  755. // 选中禁用
  756. &.is-disable {
  757. .checkbox__inner {
  758. opacity: $disable;
  759. }
  760. .checklist-text {
  761. opacity: $disable;
  762. }
  763. }
  764. }
  765. }
  766. }
  767. }
  768. }
  769. </style>