feat: 优化创建模板界面,简化无数据提示逻辑并增强树形结构类型定义
This commit is contained in:
1 parent
02610224a1
commit
5e478329bc
2 files changed
+13
-7
No files matched your search
+1
-1
@@ -25,7 +25,7 @@
|
||||
"dev:debug": "vite -d",
|
||||
"dev:debug:force": "vite -d --force",
|
||||
"build": "npm run build:pre && electron-builder --config=buildAssets/builder/config.js",
|
||||
"build:pre": "npm run format:fix && vue-tsc --noEmit && vite build",
|
||||
"build:pre": "vue-tsc --noEmit && vite build",
|
||||
"build:all": "npm run build:pre && electron-builder --config=buildAssets/builder/config.js -wml",
|
||||
"build:dir": "npm run build:pre && electron-builder --config=buildAssets/builder/config.js --dir",
|
||||
"build:mac": "npm run build:pre && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --config=buildAssets/builder/config.js --mac",
|
||||
|
||||
@@ -112,15 +112,13 @@
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-treeview>
|
||||
|
||||
<template v-slot:no-data>
|
||||
<div class="text-center pa-4">
|
||||
<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>
|
||||
</template>
|
||||
</v-treeview>
|
||||
</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