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

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

parent 43ac21cb
......@@ -28,6 +28,10 @@
flex: 1;
border-radius: 2px;
position: relative;
&.background{
display: block;
width: 100%;
}
}
.title-bar {
......
......@@ -86,6 +86,9 @@ const attrUnitMapper = {
*/
function getParentCmps(uuid, list) {
let _self = list.find(c => c.uuid === uuid);
if (!_self) {
return [];
}
let parentLoop = (uuid, list) => {
let _item = list.find(c => c.uuid === uuid);
......
<template>
<div class="zero-inspector-behavior-form" v-if="activeComponent.uuid">
<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">
<el-form-item :label="$t('Event') + ':'">
<div>{{key}}</div>
......
......@@ -4,25 +4,27 @@
<el-form ref="form" size="mini" :model="form" label-width="80px" @submit.native.prevent>
<el-collapse v-model="configColl">
<el-collapse-item title="配置" name="properties">
<el-form-item label="名称">
<el-input v-model="form.name" @input="v => handleChange('name', v)"></el-input>
</el-form-item>
<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>
<div class="zero-inspector-props-group">
<el-form-item label="名称">
<el-input v-model="form.name" @input="v => handleChange('name', v)"></el-input>
</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 title="脚本" name="scripts">
<el-collapse accordion v-if="activeComponent.scripts && activeComponent.scripts.length">
......@@ -241,7 +243,7 @@ export default {
*/
getPropValue(item, key) {
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) {
let _script = this.activeComponent.scripts[index];
......@@ -300,6 +302,12 @@ export default {
.el-divider__text {
background-color: #e9e9e9;
}
.zero-inspector-props-group{
width: 100%;
max-height: 600px;
overflow-x: hidden;
overflow-y: auto;
}
}
.script-config-dialog {
height: 350px;
......
......@@ -33,7 +33,7 @@
<script>
import { mapState, mapGetters } from 'vuex';
import wrap from './wrap';
import { styles, getParentCmps } from '../../../utils/common';
import { styles } from '../../../utils/common';
import properties from '../../../utils/properties';
import VueDraggableResizable from 'vue-draggable-resizable';
......
......@@ -26,7 +26,7 @@
<script>
import { mapState, mapGetters } from 'vuex';
import { styles, getParentCmps } from '../../../utils/common';
import { styles } from '../../../utils/common';
import properties from '../../../utils/properties';
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