Pre Merge pull request !6 from water/ts

This commit is contained in:
water 2023-04-17 06:36:24 +00:00 committed by Gitee
commit 7297eb3c16
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 7 deletions

View File

@ -18,6 +18,7 @@
},
"dependencies": {
"@element-plus/icons-vue": "2.1.0",
"@vue/runtime-core": "3.2.45",
"@vueup/vue-quill": "1.1.0",
"@vueuse/core": "9.5.0",
"animate.css": "4.1.1",

View File

@ -29,7 +29,8 @@
</template>
<script setup lang="ts">
import { ElTreeSelect } from 'element-plus'
import { ElTree } from 'element-plus';
const props = defineProps({
/* 配置项 */
@ -68,7 +69,8 @@ const props = defineProps({
})
const selectTree = ref(ElTreeSelect);
const selectTree = ref<InstanceType<typeof ElTree>>()
const treeSelect = ref<InstanceType<typeof ElSelect>>();
const emit = defineEmits(['update:value']);
@ -85,10 +87,10 @@ function initHandle() {
nextTick(() => {
const selectedValue = valueId.value;
if(selectedValue !== null && typeof (selectedValue) !== 'undefined') {
const node = selectTree.value.getNode(selectedValue)
const node = selectTree.value?.getNode(selectedValue)
if (node) {
valueTitle.value = node.data[props.objMap.label]
selectTree.value.setCurrentKey(selectedValue) //
selectTree.value?.setCurrentKey(selectedValue) //
defaultExpandedKey.value = [selectedValue] //
}
} else {
@ -100,11 +102,9 @@ function handleNodeClick(node: any) {
valueTitle.value = node[props.objMap.label]
valueId.value = node[props.objMap.value];
defaultExpandedKey.value = [];
selectTree.value.blur()
selectFilterData('')
}
function selectFilterData(val: any) {
selectTree.value.filter(val)
selectTree.value?.filter(val)
}
function filterNode(value: any, data: any) {
if (!value) return true