mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-14 18:11:48 +08:00

* feat(components): [checkbox & radio] Use value instead of label * feat(components): update * feat(components): update * feat(components): update * feat(components): update * feat(components): update * feat(components): update test * feat(components): true-value false-value * feat(components): update
64 lines
1.6 KiB
Vue
64 lines
1.6 KiB
Vue
<template>
|
|
<div>
|
|
<el-checkbox-group v-model="checkboxGroup1" size="large">
|
|
<el-checkbox-button
|
|
v-for="city in cities"
|
|
:key="city"
|
|
:label="city"
|
|
:value="city"
|
|
>
|
|
{{ city }}
|
|
</el-checkbox-button>
|
|
</el-checkbox-group>
|
|
</div>
|
|
<div class="demo-button-style">
|
|
<el-checkbox-group v-model="checkboxGroup2">
|
|
<el-checkbox-button
|
|
v-for="city in cities"
|
|
:key="city"
|
|
:label="city"
|
|
:value="city"
|
|
>{{ city }}</el-checkbox-button
|
|
>
|
|
</el-checkbox-group>
|
|
</div>
|
|
<div class="demo-button-style">
|
|
<el-checkbox-group v-model="checkboxGroup3" size="small">
|
|
<el-checkbox-button
|
|
v-for="city in cities"
|
|
:key="city"
|
|
:label="city"
|
|
:value="city"
|
|
:disabled="city === 'Beijing'"
|
|
>{{ city }}</el-checkbox-button
|
|
>
|
|
</el-checkbox-group>
|
|
</div>
|
|
<div class="demo-button-style">
|
|
<el-checkbox-group v-model="checkboxGroup4" size="small" disabled>
|
|
<el-checkbox-button
|
|
v-for="city in cities"
|
|
:key="city"
|
|
:label="city"
|
|
:value="city"
|
|
>{{ city }}</el-checkbox-button
|
|
>
|
|
</el-checkbox-group>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
const checkboxGroup1 = ref(['Shanghai'])
|
|
const checkboxGroup2 = ref(['Shanghai'])
|
|
const checkboxGroup3 = ref(['Shanghai'])
|
|
const checkboxGroup4 = ref(['Shanghai'])
|
|
const cities = ['Shanghai', 'Beijing', 'Guangzhou', 'Shenzhen']
|
|
</script>
|
|
|
|
<style scoped>
|
|
.demo-button-style {
|
|
margin-top: 24px;
|
|
}
|
|
</style>
|