Skip to content

Commit dbb8ac9

Browse files
committed
perf(hanzi): 改用 npmmirror 的 cnchar-data (感谢)
1 parent b33e48f commit dbb8ac9

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

docs/.vuepress/theme/components/hanzi/Hanzi.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { computed, onMounted, ref, shallowRef } from 'vue'
1212
1313
import {
1414
CARD_WIDTH,
15+
CNCHAR_DATA_RESOURCE,
1516
LANG,
1617
SPEAK_RATE,
1718
TIAN_HEI,
@@ -52,6 +53,8 @@ const props = defineProps({
5253
},
5354
})
5455
56+
cnchar.setResourceBase(CNCHAR_DATA_RESOURCE)
57+
5558
cnchar.use(draw, order, radical, words, voice, idiom)
5659
5760
const printRef = ref(null)

docs/.vuepress/theme/components/hanzi/Hanzi2.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import voice from 'cnchar-voice'
99
import words from 'cnchar-words'
1010
import { computed, onMounted, ref, shallowRef } from 'vue'
1111
12-
import { LANG, SPEAK_RATE } from './constants'
12+
import { CNCHAR_DATA_RESOURCE, LANG, SPEAK_RATE } from './constants'
1313
1414
import Pinyin from './Pinyin.vue'
1515
@@ -46,6 +46,8 @@ const props = defineProps({
4646
hidePinyin: Boolean,
4747
})
4848
49+
cnchar.setResourceBase(CNCHAR_DATA_RESOURCE)
50+
4951
cnchar.use(draw, order, radical, words, voice, idiom)
5052
5153
const printRef = ref(null)

docs/.vuepress/theme/components/hanzi/HanziCard.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import draw from 'cnchar-draw'
55
import { onMounted, ref, watchEffect } from 'vue'
66
77
import FlippyCard from '../flippy-card/components/card.vue'
8-
import { LANG } from './constants'
8+
import { CNCHAR_DATA_RESOURCE, LANG } from './constants'
99
import Hanzi2 from './Hanzi2.vue'
1010
1111
import './hanzi-card.scss'
@@ -40,6 +40,8 @@ const props = defineProps({
4040
hidePinyin: Boolean,
4141
})
4242
43+
cnchar.setResourceBase(CNCHAR_DATA_RESOURCE)
44+
4345
const CARD_WIDTH = 220
4446
4547
cnchar.use(draw)

docs/.vuepress/theme/components/hanzi/Zitie.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { onMounted, ref } from 'vue'
55
66
import {
77
BORDER_COLOR,
8+
CNCHAR_DATA_RESOURCE,
89
LINE_COLOR,
910
OUTLINE_COLOR,
1011
PRINT_STROKE_WIDTH,
@@ -31,6 +32,8 @@ const props = defineProps({
3132
},
3233
})
3334
35+
cnchar.setResourceBase(CNCHAR_DATA_RESOURCE)
36+
3437
const strokesRef = ref(null)
3538
const heiRef = ref(null)
3639
const huiRef = ref(null)

docs/.vuepress/theme/components/hanzi/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ export const STROKE_COLOR = '#555'
2424
export const LINE_COLOR = '#bbb'
2525
/** 田字格 外线颜色 */
2626
export const BORDER_COLOR = '#bbb'
27+
28+
// export const CNCHAR_DATA_RESOURCE = 'https://unpkg.com/cnchar-data@latest/'
29+
export const CNCHAR_DATA_RESOURCE =
30+
'https://registry.npmmirror.com/cnchar-data/latest/files/'

docs/posts/edu/xiaoxue-yuwen-2-shang-kapian-2.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
article: true
33
date: 2024-11-02
4+
sidebar: false
5+
toc: false
6+
containerClass: 'wide-content'
47
category:
58
- edu
69
- 小学

0 commit comments

Comments
 (0)