switch.vue 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. </div>
  23. </template>
  24. <script>
  25. export default {
  26. name: "config-switch",
  27. props: ['data'],
  28. methods: {
  29. handleDicClear() {
  30. this.data.dicData = [{ label: '', value: '0' }, { label: '', value: '1' }]
  31. }
  32. },
  33. }
  34. </script>
  35. <style lang="scss" scoped>
  36. .dic {
  37. display: flex;
  38. margin-bottom: 5px;
  39. }
  40. </style>