|
@@ -2,7 +2,7 @@
|
|
|
* @Author: wjc
|
|
|
* @Date: 2021-09-15 16:03:17
|
|
|
* @LastEditors: wjc
|
|
|
- * @LastEditTime: 2021-09-23 15:55:57
|
|
|
+ * @LastEditTime: 2021-09-24 14:35:46
|
|
|
* @Description:
|
|
|
-->
|
|
|
<template>
|
|
@@ -86,7 +86,9 @@ export default {
|
|
|
// 拖动组件后,给组件数据添加额外属性
|
|
|
createIdAndKey(item) {
|
|
|
const config = item.__config__
|
|
|
- config.formId = ++this.activeId
|
|
|
+ let activeId = new Date().getTime()
|
|
|
+ this.activeId = activeId
|
|
|
+ config.formId = ++activeId
|
|
|
config.renderKey = `${config.formId}${+new Date()}` // 改变renderKey后可以实现强制更新组件
|
|
|
if (config.layout === 'colFormItem') {
|
|
|
item.__vModel__ = `field${this.activeId}`
|
|
@@ -103,7 +105,6 @@ export default {
|
|
|
cloneComponent(origin) {
|
|
|
const clone = deepClone(origin)
|
|
|
const config = clone.__config__
|
|
|
- // config.span = this.formConf.span // 生成代码时,会根据span做精简判断
|
|
|
this.createIdAndKey(clone)
|
|
|
clone.placeholder !== undefined && (clone.placeholder += config.label)
|
|
|
tempActiveData = clone
|
|
@@ -111,7 +112,6 @@ export default {
|
|
|
},
|
|
|
onEnd(obj) {
|
|
|
if (obj.from !== obj.to) {
|
|
|
- this.activeId = new Date().getTime()
|
|
|
this.$emit('drag-end', tempActiveData, this.activeId)
|
|
|
}
|
|
|
}
|