123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <view class="padding-sm">
- <form action="">
- <checkbox-group class="block" @change="CheckboxChange">
- <view class=" margin-top ">
- <view class="flex align-center checkItems">
- <checkbox class="blue" :class="checkbox[0].checked?'checked':''" :checked="checkbox[0].checked?true:false" value="A"></checkbox>
- <view class="title">电力监测</view>
- </view>
- <view class="flex align-center checkItems">
- <checkbox class="blue" :class="checkbox[1].checked?'checked':''" :checked="checkbox[1].checked?true:false" value="B"></checkbox>
- <view class="title">视频报警</view>
- </view>
- </view>
- </checkbox-group>
- <view class="btn-area submitBottomBtn padding-lr-sm">
- <button class="bg-blue round margin-top">提 交 </button>
- </view>
- </form>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- checkbox: [{
- value: 'A',
- checked: false
- },
- {
- value: 'B',
- checked: false
- },
- {
- value: 'C',
- checked: false
- },
- {
- value: 'D',
- checked: false
- },
- {
- value: 'E',
- checked: false
- },
- {
- value: 'F',
- checked: false
- },
- {
- value: 'G',
- checked: false
- },
- {
- value: 'H',
- checked: false
- }
- ],
- }
- },
- methods: {
- CheckboxChange(e) {
- var items = this.checkbox,
- values = e.detail.value;
- for (var i = 0, lenI = items.length; i < lenI; ++i) {
- items[i].checked = false;
- for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
- if (items[i].value == values[j]) {
- items[i].checked = true;
- break
- }
- }
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .checkItems {
- width: 50%;
- display: inline-block;
- text-align: center;
- margin-bottom: 40rpx;
- .title {
- display: inline-block;
- margin-left: 10rpx;
- }
- }
-
- </style>
|