解决 el-cascader 文本不显示问题

This commit is contained in:
icssoa 2022-08-05 15:11:30 +08:00
parent 628650ce7c
commit ae0be71e9c
3 changed files with 32 additions and 39 deletions

View File

@ -18,7 +18,7 @@
"codemirror": "^6.0.1",
"core-js": "^3.23.5",
"echarts": "^5.3.3",
"element-plus": "^2.2.11",
"element-plus": "^2.2.12",
"file-saver": "^2.0.5",
"lodash": "^4.17.21",
"mitt": "^3.0.0",

View File

@ -1,6 +1,16 @@
<template>
<el-button type="success" @click="create">快速创建</el-button>
<cl-form ref="Form" />
<cl-form ref="Form">
<template #slot-entity="{ scope }">
<el-cascader
v-model="scope.entity"
filterable
separator="-"
:options="tree"
@change="onEntityChange"
></el-cascader>
</template>
</cl-form>
</template>
<script lang="ts" name="menu-create" setup>
@ -11,10 +21,17 @@ import { useForm } from "@cool-vue/crud";
import MenuSelect from "./select.vue";
import IconSelect from "./icon.vue";
import { deepPaths } from "/@/cool/utils";
import { ref } from "vue";
const { service } = useCool();
const Form = useForm();
//
const list: any[] = [];
//
const tree = ref();
//
async function create() {
//
@ -26,9 +43,6 @@ async function create() {
//
const eps: any[][] = await service.base.open.eps();
//
const list: any[] = [];
for (const i in eps) {
eps[i].forEach((e) => {
if (!isEmpty(e.columns)) {
@ -40,6 +54,9 @@ async function create() {
});
}
//
tree.value = deepPaths(list.map((e) => e.value));
//
Form.value?.open({
title: "快速创建",
@ -70,19 +87,7 @@ async function create() {
label: "数据结构",
span: 14,
component: {
name: "el-cascader",
props: {
filterable: true,
separator: "-",
options: deepPaths(list.map((e) => e.value)),
onChange(arr: string[]) {
const item = list.find((e) => e.value == arr.join("/"));
if (item) {
Form.value?.setForm("router", `/${item.value}`);
}
}
}
name: "slot-entity"
},
required: true
},
@ -233,4 +238,13 @@ async function create() {
}
});
}
//
function onEntityChange(arr: string[]) {
const item = list.find((e) => e.value == arr.join("/"));
if (item) {
Form.value?.setForm("router", `/${item.value}`);
}
}
</script>

View File

@ -2446,27 +2446,6 @@ electron-to-chromium@^1.4.202:
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.206.tgz#580ff85b54d7ec0c05f20b1e37ea0becdd7b0ee4"
integrity sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==
element-plus@^2.2.11:
version "2.2.11"
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.11.tgz#c242bd5ff10aea02cfc70c0b8c54cbc9b732e7ba"
integrity sha512-JjOvz5DLBc4Jp9OHKXNcK/Cys4NX5/vxpZ+gYmH2V+pLkwJnyIOrNZ3QxfdyG6yE4+NkpoA6koEgUB7T+0Z5vQ==
dependencies:
"@ctrl/tinycolor" "^3.4.1"
"@element-plus/icons-vue" "^2.0.6"
"@floating-ui/dom" "^0.5.4"
"@popperjs/core" "npm:@sxzz/popperjs-es@^2.11.7"
"@types/lodash" "^4.14.182"
"@types/lodash-es" "^4.17.6"
"@vueuse/core" "^8.7.5"
async-validator "^4.2.5"
dayjs "^1.11.3"
escape-html "^1.0.3"
lodash "^4.17.21"
lodash-es "^4.17.21"
lodash-unified "^1.0.2"
memoize-one "^6.0.0"
normalize-wheel-es "^1.2.0"
element-plus@^2.2.12:
version "2.2.12"
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.12.tgz#b6c4e298e02ba9b904d70daa54def27b2de8c43c"