<template>
<view>
<view class="uni-list">
<checkbox-group @change="checkboxChange">
<label class="uni-list-cell" v-for="item in items" :key="item.value">
<view>
<checkbox :value="item.value" :checked="item.checked" />
</view>
<view>{{item.name}}</view>
</label>
</checkbox-group>
</view>
<view class="u-select">
{{selectItem}}
</view>
</view>
</template>
<script>
export default {
data() {
return {
selectItem:'',
title: 'checkbox 复选框',
items: [{
value: 'USA',
name: '美国'
},
{
value: 'CHN',
name: '中国',
checked: 'true'
},
{
value: 'BRA',
name: '巴西'
},
{
value: 'JPN',
name: '日本'
},
{
value: 'ENG',
name: '英国'
},
{
value: 'FRA',
name: '法国'
}
]
}
},
methods: {
checkboxChange: function (e) {
let values = e.detail.value;
for(let i in values){
this.selectItem = this.selectItem + values[i];
}
}
}
}
</script>

<style>

.uni-list {
display: flex;
flex-direction: row;
}
.uni-list-cell {
display: flex;
flex-direction: row;
/* justify-content: flex-start */
}
</style>