Commit c67c09a2 authored by 张晨辰's avatar 张晨辰

fix: 属性编辑值为false时取值错误

parent 43ac21cb
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
flex: 1; flex: 1;
border-radius: 2px; border-radius: 2px;
position: relative; position: relative;
&.background{
display: block;
width: 100%;
}
} }
.title-bar { .title-bar {
......
...@@ -86,6 +86,9 @@ const attrUnitMapper = { ...@@ -86,6 +86,9 @@ const attrUnitMapper = {
*/ */
function getParentCmps(uuid, list) { function getParentCmps(uuid, list) {
let _self = list.find(c => c.uuid === uuid); let _self = list.find(c => c.uuid === uuid);
if (!_self) {
return [];
}
let parentLoop = (uuid, list) => { let parentLoop = (uuid, list) => {
let _item = list.find(c => c.uuid === uuid); let _item = list.find(c => c.uuid === uuid);
......
<template> <template>
<div class="zero-inspector-behavior-form" v-if="activeComponent.uuid"> <div class="zero-inspector-behavior-form" v-if="activeComponent.uuid">
<el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden"> <el-scrollbar class="scrollbar" wrap-class="wrap-x-hidden">
<el-form ref="form" size="mini" label-width="60px"v> <el-form ref="form" size="mini" label-width="60px">
<div v-for="(evn, key) in eventsObj" :key="key"> <div v-for="(evn, key) in eventsObj" :key="key">
<el-form-item :label="$t('Event') + ':'"> <el-form-item :label="$t('Event') + ':'">
<div>{{key}}</div> <div>{{key}}</div>
......
...@@ -4,25 +4,27 @@ ...@@ -4,25 +4,27 @@
<el-form ref="form" size="mini" :model="form" label-width="80px" @submit.native.prevent> <el-form ref="form" size="mini" :model="form" label-width="80px" @submit.native.prevent>
<el-collapse v-model="configColl"> <el-collapse v-model="configColl">
<el-collapse-item title="配置" name="properties"> <el-collapse-item title="配置" name="properties">
<el-form-item label="名称"> <div class="zero-inspector-props-group">
<el-input v-model="form.name" @input="v => handleChange('name', v)"></el-input> <el-form-item label="名称">
</el-form-item> <el-input v-model="form.name" @input="v => handleChange('name', v)"></el-input>
<el-form-item label="类型">
<el-select v-model="form.type" @change="v => handleChange('type', v)" placeholder="请选择类型">
<el-option v-for="cmp in componentsMap" :key="cmp.value" :label="cmp.label" :value="cmp.value"></el-option>
</el-select>
</el-form-item>
<template v-for="(p, key) in cmpProps">
<el-form-item v-if="key !== 'groupName'" :id="activeComponent.uuid + '-' + key" :key="activeComponent.uuid + key" :label="p.title">
<!-- {{key}} -->
<el-tooltip :disabled="!p.desc" placement="top-start">
<div slot="content">{{p.desc}}</div>
<div>
<dynamic-component :component-value="getPropValue(p, key)" :component-props="getPropProps(p)" :component-type="getPropCmpType(p)" @onChange="v => handlePropertiesChange(key, v)"></dynamic-component>
</div>
</el-tooltip>
</el-form-item> </el-form-item>
</template> <el-form-item label="类型">
<el-select v-model="form.type" @change="v => handleChange('type', v)" placeholder="请选择类型">
<el-option v-for="cmp in componentsMap" :key="cmp.value" :label="cmp.label" :value="cmp.value"></el-option>
</el-select>
</el-form-item>
<template v-for="(p, key) in cmpProps">
<el-form-item v-if="key !== 'groupName'" :id="activeComponent.uuid + '-' + key" :key="activeComponent.uuid + key" :label="p.title">
<!-- {{key}} -->
<el-tooltip :disabled="!p.desc" placement="top-start">
<div slot="content">{{p.desc}}</div>
<div>
<dynamic-component :component-value="getPropValue(p, key)" :component-props="getPropProps(p)" :component-type="getPropCmpType(p)" @onChange="v => handlePropertiesChange(key, v)"></dynamic-component>
</div>
</el-tooltip>
</el-form-item>
</template>
</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="脚本" name="scripts"> <el-collapse-item title="脚本" name="scripts">
<el-collapse accordion v-if="activeComponent.scripts && activeComponent.scripts.length"> <el-collapse accordion v-if="activeComponent.scripts && activeComponent.scripts.length">
...@@ -241,7 +243,7 @@ export default { ...@@ -241,7 +243,7 @@ export default {
*/ */
getPropValue(item, key) { getPropValue(item, key) {
let _properties = this.activeComponentCopy.properties; let _properties = this.activeComponentCopy.properties;
return _properties[key] || item.value; return (_properties[key] === undefined || _properties[key] === null) ? item.value : _properties[key];
}, },
getScriptValue(item, key, index) { getScriptValue(item, key, index) {
let _script = this.activeComponent.scripts[index]; let _script = this.activeComponent.scripts[index];
...@@ -300,6 +302,12 @@ export default { ...@@ -300,6 +302,12 @@ export default {
.el-divider__text { .el-divider__text {
background-color: #e9e9e9; background-color: #e9e9e9;
} }
.zero-inspector-props-group{
width: 100%;
max-height: 600px;
overflow-x: hidden;
overflow-y: auto;
}
} }
.script-config-dialog { .script-config-dialog {
height: 350px; height: 350px;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<script> <script>
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import wrap from './wrap'; import wrap from './wrap';
import { styles, getParentCmps } from '../../../utils/common'; import { styles } from '../../../utils/common';
import properties from '../../../utils/properties'; import properties from '../../../utils/properties';
import VueDraggableResizable from 'vue-draggable-resizable'; import VueDraggableResizable from 'vue-draggable-resizable';
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<script> <script>
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import { styles, getParentCmps } from '../../../utils/common'; import { styles } from '../../../utils/common';
import properties from '../../../utils/properties'; import properties from '../../../utils/properties';
import customNode from '../../../components/customElement/node/index.vue'; import customNode from '../../../components/customElement/node/index.vue';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment