| | |
| | | }, |
| | | watch: { |
| | | copyFlowList(nVal, oVal) { |
| | | // 取差值,即这一次数组变化新增的部分 |
| | | let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0; |
| | | // 拼接上原有数据 |
| | | this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex))); |
| | | this.splitData(); |
| | | if (!nVal || nVal.length == 0) { |
| | | this.clear(false); |
| | | // console.log('clear'); |
| | | } else { |
| | | // 取差值,即这一次数组变化新增的部分 |
| | | let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0; |
| | | // 拼接上原有数据 |
| | | this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex))); |
| | | this.splitData(); |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | computed: { |
| | | // 破坏flowList变量的引用,否则watch的结果新旧值是一样的 |
| | | copyFlowList() { |
| | | // #ifdef VUE3 |
| | | if (!this.modelValue || this.modelValue.length == 0) { |
| | | this.clear(false); |
| | | // console.log('clear'); |
| | | return []; |
| | | } else { |
| | | return this.cloneData(this.modelValue); |
| | | } |
| | | // #endif |
| | | // #ifdef VUE2 |
| | | return this.cloneData(this.value); |
| | | // #endif |
| | | // #ifdef VUE3 |
| | | return this.cloneData(this.modelValue); |
| | | // #endif |
| | | } |
| | | }, |
| | |
| | | return JSON.parse(JSON.stringify(data)); |
| | | }, |
| | | // 清空数据列表 |
| | | clear() { |
| | | clear(bak = true) { |
| | | this.leftList = []; |
| | | this.rightList = []; |
| | | // 同时清除父组件列表中的数据 |
| | | // #ifdef VUE2 |
| | | this.$emit('input', []); |
| | | // #endif |
| | | // #ifdef VUE3 |
| | | this.$emit('update:modelValue', []); |
| | | // #endif |
| | | if (bak) { |
| | | // #ifdef VUE2 |
| | | this.$emit('input', []); |
| | | // #endif |
| | | // #ifdef VUE3 |
| | | this.$emit('update:modelValue', []); |
| | | // #endif |
| | | } |
| | | this.tempList = []; |
| | | }, |
| | | // 清除某一条指定的数据,根据id实现 |
| | |
| | | max-width: 100%; |
| | | /* #endif */ |
| | | } |
| | | </style> |
| | | </style> |