<template>
	<view>
		<uni-check-list :listData="list"></uni-check-list>
	</view>
</template>

<script>
	import uniCheckList from '@/components/uni-check-list/uni-check-list.vue'
	export default {
		components: {
			uniCheckList
		},
		data() {
			return {
				list: [{
						value: 'USA',
						name: '美国'
					},
					{
						value: 'CHN',
						name: '中国',
						checked: 'true'
					},
					{
						value: 'BRA',
						name: '巴西'
					},
					{
						value: 'JPN',
						name: '日本'
					},
					{
						value: 'ENG',
						name: '英国'
					},
					{
						value: 'FRA',
						name: '法国'
					}
				]
			}
		},
		methods: {
			// 改变checkbox的选中状态
			checkboxChange(e) {
				var items = this.items,
					values = e.detail.value;
				for (var i = 0, lenI = items.length; i < lenI; ++i) {
					const item = items[i]
					if(values.includes(item.value)){
						this.$set(item,'checked',true)
					}else{
						this.$set(item,'checked',false)
					}
					console.log(item,'--------------')
				}
				
			},
			submit(){
				console.log('-------tijiao')
			}
		}
	}
</script>

<style>
</style>
