<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 class="flex align-center checkItems">
						<checkbox class="blue" :class="checkbox[2].checked?'checked':''" :checked="checkbox[2].checked?true:false" value="C"></checkbox>
						<view class="title">火警报警</view>
					</view>
					<view class="flex align-center checkItems">
						<checkbox class="blue" :class="checkbox[3].checked?'checked':''" :checked="checkbox[3].checked?true:false" value="D"></checkbox>
						<view class="title">火警报警</view>
					</view>
					<view class="flex align-center checkItems">
						<checkbox class="blue" :class="checkbox[4].checked?'checked':''" :checked="checkbox[4].checked?true:false" value="E"></checkbox>
						<view class="title">火警报警</view>
					</view>
					<view class="flex align-center checkItems">
						<checkbox class="blue" :class="checkbox[5].checked?'checked':''" :checked="checkbox[5].checked?true:false" value="F"></checkbox>
						<view class="title">火警报警</view>
					</view>
					<view class="flex align-center checkItems">
						<checkbox class="blue" :class="checkbox[6].checked?'checked':''" :checked="checkbox[6].checked?true:false" value="G"></checkbox>
						<view class="title">火警报警</view>
					</view>
					<view class="flex align-center checkItems">
						<checkbox class="blue" :class="checkbox[7].checked?'checked':''" :checked="checkbox[7].checked?true:false" value="H"></checkbox>
						<view class="title">火警报警</view>
					</view> -->
				</view>

			</checkbox-group>



			<view class="btn-area submitBottomBtn">
				<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>
