feat: 优化浏览器环境登录事件

This commit is contained in:
Frankie Huang 2025-05-06 01:48:20 +08:00
parent af3547b4b3
commit bd62afd255
2 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,7 @@
<Button v-if="!loginStatus" type="primary" shape="circle" icon="md-person"
@click="showLoginModal = true"></Button>
<Button v-else type="error" shape="circle" icon="md-log-out" @click="logout"></Button>
<SelectFolder :rootPath="rootFolderPath" :nodeDataCallback="appendDataForNode"
<SelectFolder ref="selectFolderRef" :rootPath="rootFolderPath" :nodeDataCallback="appendDataForNode"
@update:rootPath="changeRootPath" @folder-selected="showFileTree" />
</Space>
<FolderTree ref="folderTreeRef" :treeData="folderTreeData" :expandLevel="1" :selectedNode="[currentFilePath]"
@ -17,7 +17,7 @@
import UserLogin from './UI/UserLogin.vue';
import SelectFolder from './UI/SelectFolder.vue';
import FolderTree from './UI/FolderTree.vue';
import { ref } from 'vue';
import { ref, watch } from 'vue';
import { mkdir, remove, create, exists, rename } from '@tauri-apps/plugin-fs';
import { Message } from 'view-ui-plus'
@ -47,6 +47,14 @@ const logout = () => {
loginRef.value.logout();
};
const selectFolderRef = ref(null)
watch(loginStatus, (newStatus) => {
if (newStatus === true && window.__TAURI_INTERNALS__ === undefined) {
//
selectFolderRef.value.exposeTreeData();
}
})
const folderTreeRef = ref(null)
// <SelectFolder> 便 <FolderTree>
function appendDataForNode(nodeData) {

View File

@ -73,7 +73,7 @@ export default {
data.articles.forEach((article) => {
folderTreeData.nodes.push({
"path": folderPath + '/' + article.article_id,
"name": article.article_id + '.md',
"name": article.article_id + '_' + article.title,
"suffix": "md",
"directory": false,
});