index.vue 687 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <div class="station-switch">
  3. <el-switch
  4. v-model="flag"
  5. size="default"
  6. style="--el-switch-on-color: #ac014d; --el-switch-off-color: #b1b1b1"
  7. @change="
  8. (val: number) => {
  9. emit('update:flag', val)
  10. }
  11. "
  12. />
  13. <span class="switch-label">{{ label }}</span>
  14. </div>
  15. </template>
  16. <script setup lang="ts">
  17. const props = defineProps({
  18. flag: {
  19. type: Boolean,
  20. required: true,
  21. },
  22. label: {
  23. type: String,
  24. },
  25. })
  26. const emit = defineEmits(['update:flag'])
  27. </script>
  28. <style scoped lang="scss">
  29. .station-switch {
  30. height: 32px;
  31. .switch-label {
  32. padding-left: 4px;
  33. line-height: 32px;
  34. }
  35. }
  36. </style>