switch.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div>
  3. <el-form-item label="自定义">
  4. <el-button type="text"
  5. @click="handleDicClear"
  6. class="danger">清空
  7. </el-button>
  8. <div class="dic"
  9. v-for="(item, index) in data.dicData"
  10. :key="index">
  11. <el-input size="mini"
  12. v-model="item.label"
  13. placeholder="自定义文字"
  14. clearable
  15. style="margin-right: 5px"></el-input>
  16. <el-input size="mini"
  17. v-model="item.value"
  18. clearable
  19. placeholder="自定义值"></el-input>
  20. </div>
  21. </el-form-item>
  22. <el-form-item label="是否禁用">
  23. <el-switch v-model="data.disabled"></el-switch>
  24. </el-form-item>
  25. <el-form-item label="是否可见">
  26. <el-switch v-model="data.display"></el-switch>
  27. </el-form-item>
  28. </div>
  29. </template>
  30. <script>
  31. export default {
  32. name: "config-switch",
  33. props: ['data'],
  34. methods: {
  35. handleDicClear() {
  36. this.data.dicData = [{ label: '', value: '0' }, { label: '', value: '1' }]
  37. }
  38. },
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .dic {
  43. display: flex;
  44. margin-bottom: 5px;
  45. }
  46. </style>