You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

switch.vue 614 B

4 years ago
123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <view class="cu-form-group">
  3. <view class="title">{{ title }}</view>
  4. <switch
  5. @change="change"
  6. :checked="value"
  7. :disabled="disabled"
  8. :class="[value ? 'checked' : '', icon ? 'switch-' + icon : '', color ? color : '', radius ? 'radius' : '']"
  9. ></switch>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'l-switch',
  15. props: {
  16. title: {},
  17. color: {},
  18. icon: {},
  19. radius: {},
  20. disabled: {},
  21. value: {}
  22. },
  23. methods: {
  24. change(e) {
  25. this.$emit('change', e.detail.value)
  26. this.$emit('input', e.detail.value)
  27. }
  28. }
  29. }
  30. </script>