提交模型设计代码
This commit is contained in:
@@ -85,47 +85,36 @@
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import startEvent from './nodes/startEvent.vue'
|
||||
import startTask from './nodes/startTask.vue'
|
||||
import userTask from './nodes/userTask.vue'
|
||||
import exclusiveGateway from './nodes/exclusiveGateway.vue'
|
||||
import parallelGateway from './nodes/parallelGateway.vue'
|
||||
import serviceTask from './nodes/serviceTask.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
startEvent,
|
||||
startTask,
|
||||
userTask,
|
||||
exclusiveGateway,
|
||||
parallelGateway,
|
||||
serviceTask
|
||||
<script setup>
|
||||
import StartEvent from './nodes/startEvent.vue'
|
||||
import StartTask from './nodes/startTask.vue'
|
||||
import UserTask from './nodes/userTask.vue'
|
||||
import ExclusiveGateway from './nodes/exclusiveGateway.vue'
|
||||
import ParallelGateway from './nodes/parallelGateway.vue'
|
||||
import ServiceTask from './nodes/serviceTask.vue'
|
||||
import {ref,watch} from 'vue'
|
||||
const props = defineProps({
|
||||
modelValue: { type: Object, default: () => {} },
|
||||
formFieldListValue: { type: Array, default: () => [] },
|
||||
recordData: { type: Object, default: () => {} },
|
||||
processConfigInfo: { type: Object, default: () => {} },
|
||||
executionListenerArray: { type: Array, default: () => [] },
|
||||
taskListenerArray: { type: Array, default: () => [] },
|
||||
selectorApiFunction: { type: Object, default: () => {} }
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
// 创建响应式引用
|
||||
const childNode = ref({})
|
||||
// 监听 props.modelValue 的变化,并同步到 childNode.value
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newValue) => {
|
||||
childNode.value = newValue
|
||||
},
|
||||
props: {
|
||||
modelValue: { type: Object, default: () => {} },
|
||||
formFieldListValue: { type: Array, default: () => [] },
|
||||
recordData: { type: Object, default: () => {} },
|
||||
processConfigInfo: { type: Object, default: () => {} },
|
||||
executionListenerArray: { type: Array, default: () => [] },
|
||||
taskListenerArray: { type: Array, default: () => [] },
|
||||
selectorApiFunction: { type: Object, default: () => {} }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
childNode: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
modelValue(val) {
|
||||
this.childNode = val
|
||||
},
|
||||
childNode(val) {
|
||||
this.$emit('update:modelValue', val)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.childNode = this.modelValue
|
||||
}
|
||||
}
|
||||
{ immediate: true } // 立即执行一次监听器
|
||||
)
|
||||
// 监听 childNode.value 的变化,并发出自定义事件 update:modelValue
|
||||
watch(childNode, (newValue) => {
|
||||
emit('update:modelValue', newValue)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user