From d4e7c11e06b643c9353444c839cec40c25945219 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期三, 30 十月 2024 17:37:05 +0800 Subject: [PATCH] 1. 场景报告模块编写(暂存) --- src/components/SideList.vue | 62 ++++++++++++++++--------------- 1 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/components/SideList.vue b/src/components/SideList.vue index 4b440fe..fc8c61f 100644 --- a/src/components/SideList.vue +++ b/src/components/SideList.vue @@ -11,24 +11,26 @@ empty-text="鏆傛棤璁板綍" > <template #default="{ node, data }"> - <div - :class=" - data.selected - ? 'selected-tree-node custom-tree-node' - : 'custom-tree-node' - " - > - <el-icon v-if="data.type == 2" color="var(--el-color-success)" - ><SuccessFilled - /></el-icon> - <el-icon v-else-if="data.type == 1" color="var(--el-color-warning)" - ><WarningFilled - /></el-icon> - <el-icon v-else-if="data.type == 0" color="var(--el-color-danger)" - ><WarningFilled - /></el-icon> - <div>{{ node.label }}</div> - </div> + <slot :node="node" :data="data"> + <div + :class=" + data.selected + ? 'selected-tree-node custom-tree-node' + : 'custom-tree-node' + " + > + <el-icon v-if="data.type == 2" color="var(--el-color-success)" + ><SuccessFilled + /></el-icon> + <el-icon v-else-if="data.type == 1" color="var(--el-color-warning)" + ><WarningFilled + /></el-icon> + <el-icon v-else-if="data.type == 0" color="var(--el-color-danger)" + ><WarningFilled + /></el-icon> + <div>{{ node.label }}</div> + </div> + </slot> </template> </el-tree> </template> @@ -43,20 +45,20 @@ type: 0, title: 'title', categoly: '2022-10-10', - data: {}, - }, - ], + data: {} + } + ] }, - loading: Boolean, + loading: Boolean }, emits: ['itemClick'], data() { return { defaultProps: { children: 'children', - label: 'title', + label: 'title' }, - isLoading: this.loading, + isLoading: this.loading }; }, computed: { @@ -75,7 +77,7 @@ for (const [key, value] of itemMap) { const i = { title: key, - children: [], + children: [] }; value.forEach((v) => { i.children.push(v); @@ -92,11 +94,11 @@ } }); return list; - }, + } }, watch: { loading(nValue) { - this.isLoading = nValue + this.isLoading = nValue; }, //褰撴暟鎹涓�娆℃洿鏂版椂 dataList(nValue) { @@ -117,7 +119,7 @@ } this.isLoading = false; } - }, + } }, methods: { handleNodeClick(data) { @@ -131,8 +133,8 @@ if (data.children == undefined) { this.$emit('itemClick', data); } - }, - }, + } + } }; </script> -- Gitblit v1.9.3