Skip to content

Commit be4bca2

Browse files
committed
更新字体设置,支持最多设置两种字体,并调整选择组件宽度
1 parent 2bd5467 commit be4bca2

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

publish/changeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- 调换「歌词翻译」与「歌词罗马音」的位置,现在歌词罗马音在歌词翻译的上方展示
2323
*若你想要恢复以前的行为,可以开启「调换歌词翻译与歌词罗马音位置」选项*
2424
- 更新代理配置规则,现在不启用代理时,图片、音频加载将不再走系统代理 (#2382 @Folltoshe)
25+
- 字体设置可以最多设置两种字体([any-listen#82](https://github.com/any-listen/any-listen/issues/82)
2526

2627
### 其他
2728

src/renderer/components/base/Selection.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default {
120120
display: inline-block;
121121
font-size: 12px;
122122
position: relative;
123-
width: 300px;
123+
width: var(--selection-width, 300px);
124124
125125
&.active {
126126
.label {

src/renderer/views/Setting/components/SettingBasic.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ dd
6868

6969
dd
7070
h3#basic_font {{ $t('setting__basic_font') }}
71-
div
72-
base-selection.gap-teft(:list="fontList" :model-value="appSetting['common.font']" item-key="id" item-name="label" @update:model-value="updateSetting({'common.font': $event})")
71+
div(style="--selection-width: 12rem;")
72+
base-selection.gap-left(:list="fontList" :model-value="fonts[0]" item-key="id" item-name="label" @update:model-value="updateFonts($event, fonts[1])")
73+
base-selection.gap-left(v-if="fonts[0]" :list="fontList" :model-value="fonts[1]" item-key="id" item-name="label" @update:model-value="updateFonts(fonts[0], $event)")
74+
//- base-selection.gap-teft(:list="fontList" :model-value="appSetting['common.font']" item-key="id" item-name="label" @update:model-value="updateSetting({'common.font': $event})")
7375
7476
dd
7577
h3#basic_lang {{ $t('setting__basic_lang') }}
@@ -300,6 +302,17 @@ export default {
300302
systemFontList.value = fonts.map(f => ({ id: f, label: f.replace(/(^"|"$)/g, '') }))
301303
})
302304
305+
const fonts = computed(() => {
306+
if (!appSetting['common.font']) return ['', '']
307+
let [f1 = '', f2 = ''] = appSetting['common.font'].split(',')
308+
return [f1.trim(), f2.trim()]
309+
})
310+
const updateFonts = (font1, font2) => {
311+
let font = []
312+
if (font1) font.push(font1)
313+
if (font2) font.push(font2)
314+
updateSetting({ 'common.font': font.join(', ') })
315+
}
303316
const fontSizeList = computed(() => {
304317
return [
305318
{ id: 14, label: t('setting__basic_font_size_14px') },
@@ -319,6 +332,8 @@ export default {
319332
autoTheme,
320333
showAllTheme,
321334
themeList,
335+
fonts,
336+
updateFonts,
322337
// currentStting,
323338
// themes,
324339
// themeClassName,

0 commit comments

Comments
 (0)