Refactor: Extract HITOKOTO_FONT_RATIO to module-level constant

Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-25 09:57:09 +00:00
co-authored by Sunwuyuan
parent 1ca0606485
commit 628fdc52c4
+3 -2
View File
@@ -50,6 +50,9 @@ const GLOBAL_SENSITIVE_WORDS_ENCODED = [
// 解码敏感词列表 // 解码敏感词列表
const GLOBAL_SENSITIVE_WORDS = GLOBAL_SENSITIVE_WORDS_ENCODED.map(word => Base64.decode(word)) const GLOBAL_SENSITIVE_WORDS = GLOBAL_SENSITIVE_WORDS_ENCODED.map(word => Base64.decode(word))
// 一言字体大小比例(相对于全局字体大小)
const HITOKOTO_FONT_RATIO = 0.85 // Hitokoto font size is 85% of the general font size
export default { export default {
name: 'HitokotoCard', name: 'HitokotoCard',
data() { data() {
@@ -71,7 +74,6 @@ export default {
}, },
computed: { computed: {
contentStyle() { contentStyle() {
const HITOKOTO_FONT_RATIO = 0.85 // Hitokoto font size is 85% of the general font size
return { return {
'font-size': `${this.fontSize * HITOKOTO_FONT_RATIO}px`, 'font-size': `${this.fontSize * HITOKOTO_FONT_RATIO}px`,
'white-space': 'pre-wrap', 'white-space': 'pre-wrap',
@@ -80,7 +82,6 @@ export default {
} }
}, },
authorStyle() { authorStyle() {
const HITOKOTO_FONT_RATIO = 0.85 // Hitokoto font size is 85% of the general font size
const AUTHOR_FONT_RATIO = 0.6 // Author font size is 60% of the main font size const AUTHOR_FONT_RATIO = 0.6 // Author font size is 60% of the main font size
return { return {
'font-size': `${this.fontSize * HITOKOTO_FONT_RATIO * AUTHOR_FONT_RATIO}px`, 'font-size': `${this.fontSize * HITOKOTO_FONT_RATIO * AUTHOR_FONT_RATIO}px`,