Skip to content

Commit

Permalink
feat(frontend): 优化 App.vue 中的全屏和隐藏功能- 为全屏和隐藏按钮添加了 title 属性,提升用户体验
Browse files Browse the repository at this point in the history
- 优化了全屏切换逻辑,现在支持键盘快捷键 Ctrl+F 和 Esc
- 调整了全屏按钮的显示文本,根据当前状态动态变化
- 移除了不必要的 console.log 语句,简化了代码
  • Loading branch information
spark committed Jan 13, 2025
1 parent ce29514 commit a653ef9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fab5f9aa38ff92389d6726864c83c7cd
00b8e620dca5bab58d37996f0f350d0a
20 changes: 11 additions & 9 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '../wailsjs/runtime'
import {h, ref} from "vue";
import { RouterLink } from 'vue-router'
import {darkTheme, NIcon} from 'naive-ui'
import {darkTheme, NIcon, NText} from 'naive-ui'
import {
SettingsOutline,
ReorderTwoOutline,
Expand All @@ -31,10 +31,10 @@ const menuOptions = ref([
name: 'stock',
params: {
id: 'zh-CN'
}
},
}
},
{ default: () => '我的自选' }
{ default: () => '我的自选',}
),
key: 'stock',
icon: renderIcon(BarChartOutline)
Expand All @@ -59,15 +59,17 @@ const menuOptions = ref([
{
label: ()=> h("a", {
href: '#',
onClick: toggleFullscreen
}, { default: () => '全屏' }),
onClick: toggleFullscreen,
title: '全屏 Ctrl+F 退出全屏 Esc',
}, { default: () => isFullscreen.value?'取消全屏':'全屏' }),
key: 'full',
icon: renderIcon(ExpandOutline),
},
{
label: ()=> h("a", {
href: '#',
onClick: WindowHide,
title: '隐藏到托盘区 Ctrl+H',
}, { default: () => '隐藏到托盘区' }),
key: 'hide',
icon: renderIcon(ReorderTwoOutline),
Expand All @@ -94,15 +96,15 @@ function renderIcon(icon) {
return () => h(NIcon, null, { default: () => h(icon) })
}
function toggleFullscreen(e) {
console.log(e)
isFullscreen.value=!isFullscreen.value
//console.log(e)
if (isFullscreen.value) {
WindowUnfullscreen()
e.target.innerHTML = '全屏'
//e.target.innerHTML = '全屏'
} else {
WindowFullscreen()
e.target.innerHTML = '取消全屏'
// e.target.innerHTML = '取消全屏'
}
isFullscreen.value=!isFullscreen.value
}
const drag = ref(false)
const lastPos= ref({x:0,y:0})
Expand Down

0 comments on commit a653ef9

Please sign in to comment.