uni-data-checkbox.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  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.mode !== 'list') {
  375. styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
  376. }
  377. if (this.mode === 'tag') {
  378. styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
  379. }
  380. let classles = ''
  381. for (let i in styles) {
  382. classles += `${i}:${styles[i]};`
  383. }
  384. return classles
  385. },
  386. setStyleIcon(item) {
  387. let styles = {}
  388. let classles = ''
  389. let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
  390. styles['background-color'] = item.selected?selectedColor:'#fff'
  391. styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
  392. if(!item.selected && item.disabled){
  393. styles['background-color'] = '#F2F6FC'
  394. styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
  395. }
  396. for (let i in styles) {
  397. classles += `${i}:${styles[i]};`
  398. }
  399. return classles
  400. },
  401. setStyleIconText(item) {
  402. let styles = {}
  403. let classles = ''
  404. let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
  405. if (this.mode === 'tag') {
  406. styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
  407. } else {
  408. styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:selectedColor):'#666'
  409. }
  410. if(!item.selected && item.disabled){
  411. styles.color = '#999'
  412. }
  413. for (let i in styles) {
  414. classles += `${i}:${styles[i]};`
  415. }
  416. return classles
  417. },
  418. setStyleRightIcon(item) {
  419. let styles = {}
  420. let classles = ''
  421. if (this.mode === 'list') {
  422. styles['border-color'] = item.selected?this.styles.selectedColor:'#DCDFE6'
  423. }
  424. for (let i in styles) {
  425. classles += `${i}:${styles[i]};`
  426. }
  427. return classles
  428. }
  429. }
  430. }
  431. </script>
  432. <style lang="scss">
  433. $checked-color: #2979ff;
  434. $border-color: #DCDFE6;
  435. $disable:0.4;
  436. @mixin flex {
  437. /* #ifndef APP-NVUE */
  438. display: flex;
  439. /* #endif */
  440. }
  441. .uni-data-loading {
  442. @include flex;
  443. flex-direction: row;
  444. justify-content: center;
  445. align-items: center;
  446. height: 36px;
  447. padding-left: 10px;
  448. color: #999;
  449. }
  450. .uni-data-checklist {
  451. position: relative;
  452. z-index: 0;
  453. flex: 1;
  454. // 多选样式
  455. .checklist-group {
  456. @include flex;
  457. flex-direction: row;
  458. flex-wrap: wrap;
  459. &.is-list {
  460. flex-direction: column;
  461. }
  462. .checklist-box {
  463. @include flex;
  464. flex-direction: row;
  465. align-items: center;
  466. position: relative;
  467. margin: 5px 0;
  468. margin-right: 25px;
  469. .hidden {
  470. position: absolute;
  471. opacity: 0;
  472. }
  473. // 文字样式
  474. .checklist-content {
  475. @include flex;
  476. flex: 1;
  477. flex-direction: row;
  478. align-items: center;
  479. justify-content: space-between;
  480. .checklist-text {
  481. font-size: 14px;
  482. color: #666;
  483. margin-left: 5px;
  484. line-height: 14px;
  485. }
  486. .checkobx__list {
  487. border-right-width: 1px;
  488. border-right-color: #007aff;
  489. border-right-style: solid;
  490. border-bottom-width:1px;
  491. border-bottom-color: #007aff;
  492. border-bottom-style: solid;
  493. height: 12px;
  494. width: 6px;
  495. left: -5px;
  496. transform-origin: center;
  497. transform: rotate(45deg);
  498. opacity: 0;
  499. }
  500. }
  501. // 多选样式
  502. .checkbox__inner {
  503. /* #ifndef APP-NVUE */
  504. flex-shrink: 0;
  505. box-sizing: border-box;
  506. /* #endif */
  507. position: relative;
  508. width: 16px;
  509. height: 16px;
  510. border: 1px solid $border-color;
  511. border-radius: 4px;
  512. background-color: #fff;
  513. z-index: 1;
  514. .checkbox__inner-icon {
  515. position: absolute;
  516. /* #ifdef APP-NVUE */
  517. top: 2px;
  518. /* #endif */
  519. /* #ifndef APP-NVUE */
  520. top: 1px;
  521. /* #endif */
  522. left: 5px;
  523. height: 8px;
  524. width: 4px;
  525. border-right-width: 1px;
  526. border-right-color: #fff;
  527. border-right-style: solid;
  528. border-bottom-width:1px ;
  529. border-bottom-color: #fff;
  530. border-bottom-style: solid;
  531. opacity: 0;
  532. transform-origin: center;
  533. transform: rotate(40deg);
  534. }
  535. }
  536. // 单选样式
  537. .radio__inner {
  538. @include flex;
  539. /* #ifndef APP-NVUE */
  540. flex-shrink: 0;
  541. box-sizing: border-box;
  542. /* #endif */
  543. justify-content: center;
  544. align-items: center;
  545. position: relative;
  546. width: 16px;
  547. height: 16px;
  548. border: 1px solid $border-color;
  549. border-radius: 16px;
  550. background-color: #fff;
  551. z-index: 1;
  552. .radio__inner-icon {
  553. width: 8px;
  554. height: 8px;
  555. border-radius: 10px;
  556. opacity: 0;
  557. }
  558. }
  559. // 默认样式
  560. &.is--default {
  561. // 禁用
  562. &.is-disable {
  563. /* #ifdef H5 */
  564. cursor: not-allowed;
  565. /* #endif */
  566. .checkbox__inner {
  567. background-color: #F2F6FC;
  568. border-color: $border-color;
  569. /* #ifdef H5 */
  570. cursor: not-allowed;
  571. /* #endif */
  572. }
  573. .radio__inner {
  574. background-color: #F2F6FC;
  575. border-color: $border-color;
  576. }
  577. .checklist-text {
  578. color: #999;
  579. }
  580. }
  581. // 选中
  582. &.is-checked {
  583. .checkbox__inner {
  584. border-color: $checked-color;
  585. background-color: $checked-color;
  586. .checkbox__inner-icon {
  587. opacity: 1;
  588. transform: rotate(45deg);
  589. }
  590. }
  591. .radio__inner {
  592. border-color: $checked-color;
  593. .radio__inner-icon {
  594. opacity: 1;
  595. background-color: $checked-color;
  596. }
  597. }
  598. .checklist-text {
  599. color: $checked-color;
  600. }
  601. // 选中禁用
  602. &.is-disable {
  603. .checkbox__inner {
  604. opacity: $disable;
  605. }
  606. .checklist-text {
  607. opacity: $disable;
  608. }
  609. .radio__inner {
  610. opacity: $disable;
  611. }
  612. }
  613. }
  614. }
  615. // 按钮样式
  616. &.is--button {
  617. margin-right: 10px;
  618. padding: 5px 10px;
  619. border: 1px $border-color solid;
  620. border-radius: 3px;
  621. transition: border-color 0.2s;
  622. // 禁用
  623. &.is-disable {
  624. /* #ifdef H5 */
  625. cursor: not-allowed;
  626. /* #endif */
  627. border: 1px #eee solid;
  628. opacity: $disable;
  629. .checkbox__inner {
  630. background-color: #F2F6FC;
  631. border-color: $border-color;
  632. /* #ifdef H5 */
  633. cursor: not-allowed;
  634. /* #endif */
  635. }
  636. .radio__inner {
  637. background-color: #F2F6FC;
  638. border-color: $border-color;
  639. /* #ifdef H5 */
  640. cursor: not-allowed;
  641. /* #endif */
  642. }
  643. .checklist-text {
  644. color: #999;
  645. }
  646. }
  647. &.is-checked {
  648. border-color: $checked-color;
  649. .checkbox__inner {
  650. border-color: $checked-color;
  651. background-color: $checked-color;
  652. .checkbox__inner-icon {
  653. opacity: 1;
  654. transform: rotate(45deg);
  655. }
  656. }
  657. .radio__inner {
  658. border-color: $checked-color;
  659. .radio__inner-icon {
  660. opacity: 1;
  661. background-color: $checked-color;
  662. }
  663. }
  664. .checklist-text {
  665. color: $checked-color;
  666. }
  667. // 选中禁用
  668. &.is-disable {
  669. opacity: $disable;
  670. }
  671. }
  672. }
  673. // 标签样式
  674. &.is--tag {
  675. margin-right: 10px;
  676. padding: 5px 10px;
  677. border: 1px $border-color solid;
  678. border-radius: 3px;
  679. background-color: #f5f5f5;
  680. .checklist-text {
  681. margin: 0;
  682. color: #666;
  683. }
  684. // 禁用
  685. &.is-disable {
  686. /* #ifdef H5 */
  687. cursor: not-allowed;
  688. /* #endif */
  689. opacity: $disable;
  690. }
  691. &.is-checked {
  692. background-color: $checked-color;
  693. border-color: $checked-color;
  694. .checklist-text {
  695. color: #fff;
  696. }
  697. }
  698. }
  699. // 列表样式
  700. &.is--list {
  701. /* #ifndef APP-NVUE */
  702. display: flex;
  703. /* #endif */
  704. padding: 10px 15px;
  705. padding-left: 0;
  706. margin: 0;
  707. &.is-list-border {
  708. border-top: 1px #eee solid;
  709. }
  710. // 禁用
  711. &.is-disable {
  712. /* #ifdef H5 */
  713. cursor: not-allowed;
  714. /* #endif */
  715. .checkbox__inner {
  716. background-color: #F2F6FC;
  717. border-color: $border-color;
  718. /* #ifdef H5 */
  719. cursor: not-allowed;
  720. /* #endif */
  721. }
  722. .checklist-text {
  723. color: #999;
  724. }
  725. }
  726. &.is-checked {
  727. .checkbox__inner {
  728. border-color: $checked-color;
  729. background-color: $checked-color;
  730. .checkbox__inner-icon {
  731. opacity: 1;
  732. transform: rotate(45deg);
  733. }
  734. }
  735. .radio__inner {
  736. .radio__inner-icon {
  737. opacity: 1;
  738. }
  739. }
  740. .checklist-text {
  741. color: $checked-color;
  742. }
  743. .checklist-content {
  744. .checkobx__list {
  745. opacity: 1;
  746. border-color: $checked-color;
  747. }
  748. }
  749. // 选中禁用
  750. &.is-disable {
  751. .checkbox__inner {
  752. opacity: $disable;
  753. }
  754. .checklist-text {
  755. opacity: $disable;
  756. }
  757. }
  758. }
  759. }
  760. }
  761. }
  762. }
  763. </style>