51 lines
1.1 KiB
Vue
51 lines
1.1 KiB
Vue
<!--
|
||
* 文件说明:动态节点包装器,挂载具体节点并同步内容变化。
|
||
* 作用范围:仅服务于流程设计器模块。
|
||
-->
|
||
<template>
|
||
<div class="node__box">
|
||
<component :is="componentId" :model="props.model" :properties="props.properties" ref="nodeRef" @contentChange="contentChange"></component>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { onMounted, ref } from 'vue'
|
||
// import ArmNode from '../nodes/mechanical/arm.vue';
|
||
|
||
const props = defineProps({
|
||
model: Object,
|
||
properties: Object,
|
||
component: Object,
|
||
});
|
||
|
||
const emits = defineEmits(['contentChange', 'bindRef'])
|
||
|
||
const componentId = ref(props.component)
|
||
|
||
/**
|
||
* 处理 contentChange 对应的数据或交互;作用范围仅限当前组件或模块。
|
||
*/
|
||
const contentChange = () => {
|
||
emits('contentChange')
|
||
}
|
||
|
||
const nodeRef = ref()
|
||
onMounted(() => {
|
||
emits('bindRef', nodeRef.value)
|
||
})
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.node__box {
|
||
width: 320px;
|
||
height: auto;
|
||
background: #fff;
|
||
padding: 12px;
|
||
cursor: default;
|
||
border-radius: 12px;
|
||
border: 2px solid white;
|
||
box-shadow: 0 5px 15px 0#00000008;
|
||
position: relative;
|
||
}
|
||
</style>
|