uni-data-checkbox.vue 20 KB

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