Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ 将设置界面独立为一个窗口 #75

Draft
wants to merge 3 commits into
base: next
Choose a base branch
from
Draft

Conversation

AzideCupric
Copy link
Collaborator

已知问题

  • 无法拖拽设置窗口

@AzideCupric AzideCupric marked this pull request as draft July 10, 2024 09:46
Comment on lines +3 to +24
#[command]
pub async fn open_setting_page(handle: AppHandle) {
let setting_page = handle.get_window("settings").unwrap();
// 居主页面之中
setting_page.center().unwrap();
setting_page.show().unwrap();
setting_page.set_focus().unwrap();
setting_page
.clone()
.on_window_event(move |event| {
if let WindowEvent::CloseRequested { api, .. } = event {
api.prevent_close();
setting_page.hide().unwrap();
}
});
}

#[command]
pub async fn close_setting_page(handle: AppHandle) {
let setting_window = handle.get_window("settings").unwrap();
setting_window.hide().unwrap();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

关窗口这个不需要rust这边来,前端就有接口关

Comment on lines +3 to +4
#[command]
pub async fn open_setting_page(handle: AppHandle) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里面的都是tauri的api返回的Result,可以将接口返回写为 Result<(), tauri::Error> 然后去除内部的unwrap

Comment on lines 147 to +171
const setting = reactive<{
// auto boot setting
autoBoot: boolean,
initAutoBoot: () => void,
setAutoBoot: () => void,
// quit
close: () => void,
checkUpdate: () => void
autoBoot: boolean;
initAutoBoot: () => void;
setAutoBoot: () => void;
// quit
close: () => void;
checkUpdate: () => void;
// notification
notify_mode: { idx: number, tip: string, value: string },
initNotifyMode: () => void
setNotifyMode: () => void
notify_mode: { idx: number; tip: string; value: string };
initNotifyMode: () => void;
setNotifyMode: () => void;
//version
currentVersion: string,
getAppVersion: () => void
currentVersion: string;
getAppVersion: () => void;
}>({
currentVersion: "",
getAppVersion: () => {
app.getVersion().then((version) => {
setting.currentVersion = version
})
setting.currentVersion = version;
});
},
notify_mode: NotifyMode.PopUpAndBeep,
initNotifyMode: () => {
notification.getNotificationMode()
.then((v) => setting.notify_mode = v)
notification.getNotificationMode().then((v) => (setting.notify_mode = v));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得这边设置可以通过后端来动态处理,而不是现在这样写死

<v-app class="setting">

<div >
<v-app-bar title="设置" id="drag" color="#e6a23c" density="compact" data-tauri-drag-region>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果无法拖动,要不启用decorator?

@Goodjooy Goodjooy changed the base branch from master to next July 25, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants