feat: 优化创建模板界面,简化无数据提示逻辑并增强树形结构类型定义
This commit is contained in:
1 parent
02610224a1
commit
5e478329bc
2 files changed
+17
-11
No files matched your search
@@ -112,15 +112,13 @@
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:no-data>
|
||||
<div class="text-center pa-4">
|
||||
<v-icon size="48" color="grey-lighten-1">mdi-folder-open-outline</v-icon>
|
||||
<p class="text-body-2 mt-2">暂无文件或目录</p>
|
||||
<p class="text-caption">右键点击空白区域添加根目录或文件</p>
|
||||
</div>
|
||||
</template>
|
||||
</v-treeview>
|
||||
|
||||
<div v-if="treeItems.length === 0" class="text-center pa-4">
|
||||
<v-icon size="48" color="grey-lighten-1">mdi-folder-open-outline</v-icon>
|
||||
<p class="text-body-2 mt-2">暂无文件或目录</p>
|
||||
<p class="text-caption">右键点击空白区域添加根目录或文件</p>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<!-- Context Menu -->
|
||||
@@ -259,14 +257,22 @@ const editingFileContent = ref('')
|
||||
const expandedNodes = ref<string[]>([])
|
||||
const treeHeight = ref(600)
|
||||
|
||||
// Define type for tree items
|
||||
interface TreeItem {
|
||||
id: string
|
||||
name: string
|
||||
type: 'directory' | 'file'
|
||||
children?: TreeItem[]
|
||||
}
|
||||
|
||||
// Item state
|
||||
const directories = ref<{ path: string }[]>([])
|
||||
const files = ref<{ path: string; content: string }[]>([])
|
||||
|
||||
// Computed
|
||||
const isEditMode = computed(() => !!route.params.id)
|
||||
const treeItems = computed(() => {
|
||||
const items = []
|
||||
const treeItems = computed<TreeItem[]>(() => {
|
||||
const items: TreeItem[] = []
|
||||
|
||||
// Add directories
|
||||
directories.value.forEach(dir => {
|
||||
|
||||
Reference in new issue
Block a user