Skip to content

Commit

Permalink
fix: zigen.json route error
Browse files Browse the repository at this point in the history
  • Loading branch information
yb6b committed May 16, 2024
1 parent ee6c679 commit 879eb32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/search/share.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from '../train/share'
import { HanziCard, ZigenCardMap, HanziCardMap, fetchJsonWithCache } from "../train/share";
import { useRoute } from "vitepress";

// 用于缓存四角号码数据
export let cache: Record<string, any> = {}

Expand Down Expand Up @@ -95,7 +96,9 @@ export function prehandleJson(json: object) {
/** 从vitepress的路由里推断当前使用的方案英文名称 */
export function getSchemaNameFromRoute() {
const route = useRoute()
return route.path.split('/')[1]
const routeSplit = route.path.split('/')
if (routeSplit[1] === 'yima') return routeSplit[2]
return routeSplit[1]
}

/** 请求汉字、字根的JSON文件 如果没有填JSON名,会根据URl推断一个 */
Expand Down

0 comments on commit 879eb32

Please sign in to comment.