button-style.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <div>
  3. <el-checkbox-group v-model="checkboxGroup1" size="large">
  4. <el-checkbox-button v-for="city in cities" :key="city" :label="city">
  5. {{ city }}
  6. </el-checkbox-button>
  7. </el-checkbox-group>
  8. </div>
  9. <div class="demo-button-style">
  10. <el-checkbox-group v-model="checkboxGroup2">
  11. <el-checkbox-button v-for="city in cities" :key="city" :label="city">{{
  12. city
  13. }}</el-checkbox-button>
  14. </el-checkbox-group>
  15. </div>
  16. <div class="demo-button-style">
  17. <el-checkbox-group v-model="checkboxGroup3" size="small">
  18. <el-checkbox-button
  19. v-for="city in cities"
  20. :key="city"
  21. :label="city"
  22. :disabled="city === 'Beijing'"
  23. >{{ city }}</el-checkbox-button
  24. >
  25. </el-checkbox-group>
  26. </div>
  27. <div class="demo-button-style">
  28. <el-checkbox-group v-model="checkboxGroup4" size="small" disabled>
  29. <el-checkbox-button v-for="city in cities" :key="city" :label="city">{{
  30. city
  31. }}</el-checkbox-button>
  32. </el-checkbox-group>
  33. </div>
  34. </template>
  35. <script lang="ts" setup>
  36. import { ref } from 'vue'
  37. const checkboxGroup1 = ref(['Shanghai'])
  38. const checkboxGroup2 = ref(['Shanghai'])
  39. const checkboxGroup3 = ref(['Shanghai'])
  40. const checkboxGroup4 = ref(['Shanghai'])
  41. const cities = ['Shanghai', 'Beijing', 'Guangzhou', 'Shenzhen']
  42. </script>
  43. <style scoped>
  44. .demo-button-style {
  45. margin-top: 24px;
  46. }
  47. </style>