舞台编辑修复-下拉框实时更新信息

This commit is contained in:
lyd
2022-08-22 09:43:33 +08:00
parent 2d60244b82
commit e6646ecf92
2 changed files with 27 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
<template> <template>
<div class="diagram"> <div class="diagram">
<diagram-toolbar <diagram-toolbar
style="z-index: 1"
v-if="lf" v-if="lf"
class="diagram-toolbar" class="diagram-toolbar"
:lf="lf" :lf="lf"
@@ -37,6 +38,7 @@
:only-edge="activeNodes.length === 0" :only-edge="activeNodes.length === 0"
:elements-style="properties" :elements-style="properties"
:show-choice="showChoice" :show-choice="showChoice"
:node="nodeObj"
@setStyle="$_setStyle" @setStyle="$_setStyle"
@setZIndex="$_setZIndex" @setZIndex="$_setZIndex"
/> />
@@ -92,7 +94,8 @@ export default {
nodeSize: { nodeSize: {
width: '', width: '',
heigh: '' heigh: ''
} },
nodeObj: {} // 给子组件传递信息
} }
}, },
mounted() { mounted() {
@@ -182,11 +185,13 @@ export default {
}, },
// 获取可以进行设置的属性 // 获取可以进行设置的属性
$_getProperty() { $_getProperty() {
// console.log('选中') console.log('选中')
let properties = {} let properties = {}
const { nodes, edges } = this.lf.getSelectElements() const { nodes, edges } = this.lf.getSelectElements()
// const graphModel = this.lf.graphModel // const graphModel = this.lf.graphModel
// console.log(graphModel) console.log(nodes)
// 只传第一个,以第一个为显示是否绑定设备等信息,其余显示正常不用处理
this.nodeObj = nodes[0]
nodes.forEach(node => { nodes.forEach(node => {
if (node.type === 'html-node') { if (node.type === 'html-node') {
this.showChoice = true this.showChoice = true

View File

@@ -160,6 +160,7 @@
size="mini" size="mini"
:min="0" :min="0"
:max="360" :max="360"
:step="90"
@change="$_changeTransform" @change="$_changeTransform"
/> />
<span></span> <span></span>
@@ -197,7 +198,8 @@ export default {
props: { props: {
elementsStyle: Object, elementsStyle: Object,
onlyEdge: Boolean, // 是否是只设置边的属性,当只设置边的属性时,隐藏快捷样式和背景色设置 onlyEdge: Boolean, // 是否是只设置边的属性,当只设置边的属性时,隐藏快捷样式和背景色设置
showChoice: Boolean showChoice: Boolean,
node: Object // 父组件传来的对象
}, },
data() { data() {
return { return {
@@ -236,6 +238,11 @@ export default {
this.style = { ...this.style, ...val } this.style = { ...this.style, ...val }
}, },
immediate: true immediate: true
},
node(newVal, oldVal) {
// newVal是新值oldVal是旧值
this.node = newVal
this.cleanParam()
} }
}, },
created() { created() {
@@ -344,6 +351,17 @@ export default {
this.$emit('setStyle', { this.$emit('setStyle', {
device: val device: val
}) })
},
cleanParam() { // 判断来清空下拉框
if (this.node.properties.device === undefined) {
this.style.device = ''
}
if (this.node.properties.imageUrl === undefined) {
this.style.imageUrl = ''
}
if (this.node.properties.transform === undefined) {
this.style.transform = 0
}
} }
} }
} }