Skip to content

Commit

Permalink
* 字典支持插件目录
Browse files Browse the repository at this point in the history
  • Loading branch information
okami-chen authored Nov 20, 2024
1 parent 4f11da1 commit b3e0cd9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/src/provider/dictionary/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import type { App } from 'vue'
const dictionary: Record<string, Dictionary[]> = {}
async function getDictionary() {
const data = import.meta.glob('./data/**.{ts,js}')
for (const dic in data) {
const d: any = await data[dic]()
const name: string | undefined = dic.match('/data/(.*).(ts|js)')?.[1] ?? undefined
const pluginData = import.meta.glob('../../plugins/*/*/dictionary/**.{ts,js}')
const allData = { ...data, ...pluginData }
for (const dic in allData) {
const d: any = await allData[dic]()
const name: string | undefined = dic.match(/\/(data|plugins\/.*\/dictionary)\/(.*)\.(ts|js)/)?.[2] ?? undefined
if (name) {
dictionary[name] = d.default
}
Expand Down

0 comments on commit b3e0cd9

Please sign in to comment.