Files
element-plus/docs/examples/checkbox/button-style.vue
kooriookami 3ca4473aeb feat(components): [checkbox & radio] Use value instead of label act as value (#15525)
* 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
2024-02-28 12:48:07 +08:00

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>