@@ -12,7 +12,7 @@ import { computed } from "vue";
1212import { getPinyinOf } from " ../utils/hanzi" ;
1313import { TypingSummary } from " ../utils/summary" ;
1414import { followKeys , leadKeys } from " ../utils/pinyin" ;
15- import { randInt , randomChoice } from " ../utils/number" ;
15+ import { randInt } from " ../utils/number" ;
1616
1717export interface SingleModeProps {
1818 nextChar? : () => string ;
@@ -21,7 +21,7 @@ export interface SingleModeProps {
2121 mode? : " Lead" | " Follow" ;
2222}
2323
24- function nextChar () {
24+ function getNextChar () {
2525 if (! props .mode ) {
2626 return props .nextChar ?.() ?? " " ;
2727 }
@@ -32,7 +32,7 @@ const pinyin = ref<string[]>([]);
3232
3333const store = useStore ();
3434const props = defineProps <SingleModeProps >();
35- const hanziSeq = ref (new Array (4 ).fill (0 ).map (() => nextChar ()));
35+ const hanziSeq = ref (new Array (4 ).fill (0 ).map (() => getNextChar ()));
3636const isValid = ref (false );
3737
3838const summary = ref (new TypingSummary ());
@@ -78,7 +78,7 @@ function onMenuChange(i: number) {
7878
7979watchPostEffect (() => {
8080 for (let i = 0 ; i < 4 ; ++ i ) {
81- hanziSeq .value .unshift (nextChar ());
81+ hanziSeq .value .unshift (getNextChar ());
8282 hanziSeq .value .pop ();
8383 }
8484});
@@ -132,7 +132,7 @@ function onSeq([lead, follow]: [string?, string?]) {
132132watchPostEffect (() => {
133133 if (isValid .value ) {
134134 setTimeout (() => {
135- hanziSeq .value .unshift (nextChar ());
135+ hanziSeq .value .unshift (getNextChar ());
136136 hanziSeq .value .pop ();
137137 pinyin .value = [];
138138 isValid .value = false ;
0 commit comments