Skip to content

Commit 598b209

Browse files
committed
refactor(setting): 优化设置显示效果
1 parent d84c43a commit 598b209

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

src/components/Setting/SettingItemRenderer.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
class="set"
5454
:round="false"
5555
:disabled="isDisabled"
56+
:title="resolve(props.item.title)"
5657
v-bind="item.componentProps"
5758
/>
5859

@@ -63,6 +64,7 @@
6364
:options="normalizedOptions"
6465
class="set"
6566
:disabled="isDisabled"
67+
:title="resolve(props.item.title)"
6668
v-bind="item.componentProps"
6769
/>
6870

@@ -75,6 +77,7 @@
7577
:max="resolve(item.max)"
7678
:step="resolve(item.step)"
7779
:disabled="isDisabled"
80+
:title="resolve(props.item.title)"
7881
v-bind="item.componentProps"
7982
>
8083
<template #prefix v-if="item.prefix">{{ resolve(item.prefix) }}</template>
@@ -90,6 +93,7 @@
9093
:type="item.componentProps?.type || 'text'"
9194
:show-password-on="item.componentProps?.showPasswordOn"
9295
:disabled="isDisabled"
96+
:title="resolve(props.item.title)"
9397
v-bind="item.componentProps"
9498
>
9599
<template #prefix v-if="item.prefix">{{ resolve(item.prefix) }}</template>
@@ -107,6 +111,7 @@
107111
:marks="item.marks"
108112
:format-tooltip="item.formatTooltip"
109113
:disabled="isDisabled"
114+
:title="resolve(props.item.title)"
110115
v-bind="item.componentProps"
111116
/>
112117

@@ -118,6 +123,7 @@
118123
secondary
119124
@click="handleAction"
120125
:disabled="isDisabled"
126+
:title="resolve(props.item.title)"
121127
v-bind="item.componentProps"
122128
>
123129
{{ resolve(item.buttonLabel) || "配置" }}
@@ -131,6 +137,7 @@
131137
:show-alpha="item.componentProps?.showAlpha ?? false"
132138
:modes="item.componentProps?.modes ?? ['hex']"
133139
:disabled="isDisabled"
140+
:title="resolve(props.item.title)"
134141
@complete="handleAction"
135142
/>
136143

src/components/Setting/config/lyric.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export const useLyricSettings = (): SettingConfig => {
124124
max: 40,
125125
suffix: "px",
126126
disabled: computed(() => settingStore.useAMLyrics),
127+
title: computed(() => settingStore.useAMLyrics ? "由 AMLL 自动控制" : ""),
127128
value: computed({
128129
get: () => tranFontSize.value,
129130
set: (v) => (tranFontSize.value = v || 22),
@@ -139,6 +140,7 @@ export const useLyricSettings = (): SettingConfig => {
139140
max: 40,
140141
suffix: "px",
141142
disabled: computed(() => settingStore.useAMLyrics),
143+
title: computed(() => settingStore.useAMLyrics ? "由 AMLL 自动控制" : ""),
142144
value: computed({
143145
get: () => romaFontSize.value,
144146
set: (v) => (romaFontSize.value = v || 18),

src/components/Setting/config/play.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ export const usePlaySettings = (): SettingConfig => {
5959
},
6060
);
6161
}
62+
if (option.value === "mpv" && option.disabled) {
63+
return h(
64+
NTooltip,
65+
{ placement: "left", keepAliveOnHover: false },
66+
{
67+
trigger: () => h("div", { style: "cursor: not-allowed;" }, [node]),
68+
default: () => "当前环境不支持 MPV 引擎",
69+
},
70+
);
71+
}
6272
return node;
6373
};
6474

@@ -70,7 +80,11 @@ export const usePlaySettings = (): SettingConfig => {
7080
value: "ffmpeg",
7181
disabled: !checkIsolationSupport(),
7282
},
73-
{ label: "MPV", value: "mpv" },
83+
{
84+
label: "MPV",
85+
value: "mpv",
86+
disabled: !isElectron,
87+
},
7488
];
7589

7690
// 当前选中的引擎值
@@ -98,7 +112,11 @@ export const usePlaySettings = (): SettingConfig => {
98112
}
99113

100114
// 如果切换到 MPV 引擎,先检查是否已安装
101-
if (targetPlaybackEngine === "mpv" && isElectron) {
115+
if (targetPlaybackEngine === "mpv") {
116+
if (!isElectron) {
117+
window.$message.warning("当前环境不支持 MPV 引擎,已回退至默认引擎");
118+
return;
119+
}
102120
try {
103121
const result = await window.electron.ipcRenderer.invoke("mpv-check-installed");
104122
if (!result.installed) {
@@ -477,6 +495,7 @@ export const usePlaySettings = (): SettingConfig => {
477495
{
478496
title: "音乐解锁",
479497
tags: [{ text: "Beta", type: "warning" }],
498+
show: isElectron,
480499
items: [
481500
{
482501
key: "useSongUnlock",
@@ -487,7 +506,6 @@ export const usePlaySettings = (): SettingConfig => {
487506
get: () => settingStore.useSongUnlock,
488507
set: (v) => (settingStore.useSongUnlock = v),
489508
}),
490-
show: isElectron,
491509
},
492510
{
493511
key: "songUnlockConfig",
@@ -497,7 +515,6 @@ export const usePlaySettings = (): SettingConfig => {
497515
buttonLabel: "配置",
498516
action: openSongUnlockManager,
499517
disabled: computed(() => !settingStore.useSongUnlock),
500-
show: isElectron,
501518
},
502519
],
503520
},

src/types/settings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ export interface SettingItem {
121121
*/
122122
disabled?: MaybeRefOrGetter<boolean>;
123123

124+
/**
125+
* 标题
126+
* 一般用作鼠标悬停时会显示的提示
127+
*/
128+
title?: MaybeRefOrGetter<string>;
129+
124130
/**
125131
* 子项展开条件
126132
* 仅当存在 `children` 时有效

0 commit comments

Comments
 (0)