Skip to content

Commit

Permalink
perf: 优化树形下拉框预览效果
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Feb 20, 2021
1 parent 3642218 commit b30ac1d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/component/form-designer/src/GenerateFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ export default class GenerateFormItem extends Vue {
}
this.copyOption = this.widget.options.remoteOptions;
});
} else if (this.widget.options.remote === 'custom') {
this.visible = true;
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/component/form-designer/src/WidgetFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,12 @@
:style="{width: element.options.width}"
:options="element.options.remoteOptions">
</el-cascader>
</template>
<template v-if="element.type ==='comment'">
<h4 style="text-align:center;margin:0">意见框</h4>
</template>
<template v-if="element.type ==='table'">
<h4 style="text-align:center;margin:0">表格({{element.model}})</h4>
</template>
<template v-if="element.type === 'treeselect'">
<h4 style="text-align:center;margin:0">树形下拉框({{element.model}})</h4>
<TreeSelect v-model="element.options.defaultValue" :options="[]" />
</template>
<template v-if="element.type === 'richtext'">
<Tinymce :height="400"
Expand Down Expand Up @@ -249,6 +246,7 @@
</template>

<script>
import TreeSelect from '@riophae/vue-treeselect';
import Tinymce from './components/Tinymce'; // 富文本编辑器
import lineChart from './components/Charts/lineChart.vue';
import pieChart from './components/Charts/pieChart.vue';
Expand Down Expand Up @@ -285,6 +283,7 @@ export default {
lineChart,
Echarts,
AvatarUpload,
TreeSelect,
},
data() {
return {
Expand Down
19 changes: 18 additions & 1 deletion src/component/form-designer/src/componentsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ export const advanceComponents = [
remoteFunc: '',
placeholder: '',
width: '100%',
defaultValue: null,
maxHeight: 300,
multiple: false,
remote: 'custom',
Expand All @@ -447,7 +448,23 @@ export const advanceComponents = [
disabled: false,
showCount: false,
disableBranchNodes: true,
remoteOptions: [],
remoteOptions: [{
value: '测试数据A',
label: '测试数据A',
children: [{
value: '测试数据AA',
label: '测试数据AA',
}, {
value: '测试数据AB',
label: '测试数据AB',
}],
}, {
value: '测试数据B',
label: '测试数据B',
}, {
value: '测试数据C',
label: '测试数据C',
}],
hiddenLabel: false,
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/component/form-designer/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -653,5 +653,5 @@ $primary-background-color: #ecf5ff;
top: 200px;
left: 50%;
margin-left: -150px;
color: #ccc;
color: #aaa;
}

0 comments on commit b30ac1d

Please sign in to comment.