bySwitch.vue 938 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <el-switch
  3. v-model="value"
  4. :active-color="attrs.activeColor"
  5. :inactive-color="attrs.inactiveColor"
  6. :disabled="attrs.disabled"
  7. :width="attrs.width"
  8. :active-text="attrs.activeText"
  9. :inactive-text="attts.inactiveText"
  10. :active-value="attrs.activeValue"
  11. :inactive-value="attrs.inactiveValue"
  12. @change="change"
  13. >
  14. </el-switch>
  15. </template>
  16. <script lang="ts">
  17. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  18. import VueViews from '@/benyun/compVue/VueViews';
  19. @Component
  20. export default class BySwitch extends VueViews {
  21. value:any=null
  22. created(){
  23. if(this.propConfig){
  24. this.setConfig(this.propConfig)
  25. }
  26. }
  27. setValue(v:any){
  28. this.value = v;
  29. }
  30. getValue(){
  31. return this.value;
  32. }
  33. // 清空数据
  34. clearValue(){
  35. this.value = null
  36. }
  37. change(v:any){
  38. this.$emit('onChange',v);
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. </style>