button-style.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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">{{ city }}</el-checkbox-button>
  12. </el-checkbox-group>
  13. </div>
  14. <div class="demo-button-style">
  15. <el-checkbox-group v-model="checkboxGroup3" size="small">
  16. <el-checkbox-button v-for="city in cities" :key="city" :label="city" :disabled="city === 'Beijing'">{{ city }}</el-checkbox-button>
  17. </el-checkbox-group>
  18. </div>
  19. <div class="demo-button-style">
  20. <el-checkbox-group v-model="checkboxGroup4" size="small" disabled>
  21. <el-checkbox-button v-for="city in cities" :key="city" :label="city">{{ city }}</el-checkbox-button>
  22. </el-checkbox-group>
  23. </div>
  24. </template>
  25. <script lang="ts" setup>
  26. import { ref } from 'vue'
  27. const checkboxGroup1 = ref(['Shanghai'])
  28. const checkboxGroup2 = ref(['Shanghai'])
  29. const checkboxGroup3 = ref(['Shanghai'])
  30. const checkboxGroup4 = ref(['Shanghai'])
  31. const cities = ['Shanghai', 'Beijing', 'Guangzhou', 'Shenzhen']
  32. </script>
  33. <style scoped>
  34. .demo-button-style {
  35. margin-top: 24px;
  36. }
  37. </style>