diff --git a/README.md b/README.md index 6bf4f9ef..e8850e53 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ - 主题切换 - 错误页 -- 封装了一些小组件 +- 动态切换主题、贴花的 `EChart` 图 +- 带有拓展功能的表格 - 还有一些不值一提的小东西... ## 预览地址 diff --git a/package.json b/package.json index e2578088..370008be 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dayjs": "^1.11.7", "echarts": "^5.4.0", "lodash-es": "^4.17.21", - "naive-ui": "^2.34.0", + "naive-ui": "^2.34.3", "pinia": "^2.0.17", "pinia-plugin-persistedstate": "^2.4.0", "print-js": "^1.6.0", diff --git a/src/components/RayTable/src/components/TableSetting/index.scss b/src/components/RayTable/src/components/TableSetting/index.scss index 2a4cbcfb..23d8e6cb 100644 --- a/src/components/RayTable/src/components/TableSetting/index.scss +++ b/src/components/RayTable/src/components/TableSetting/index.scss @@ -19,9 +19,8 @@ $activedColor: #2080f0; .ray-table__setting-option--draggable { display: grid; grid-row-gap: 10px; - justify-items: center; - align-items: center; - justify-content: center; + justify-self: center; + align-self: center; & .draggable-item { display: flex; diff --git a/src/language/index.ts b/src/language/index.ts index 50025e4c..38589f1f 100644 --- a/src/language/index.ts +++ b/src/language/index.ts @@ -24,7 +24,7 @@ import type { App } from 'vue' * * @remak 未避免出现加载语言错误问题, 故而在 `main.ts` 注册时, 应优先加载 `i18n` 避免出现该问题 */ -export const useDefaultLocal = () => { +export const getDefaultLocal = () => { const locale: string = getCache('localeLanguage', 'localStorage') !== 'no' ? getCache('localeLanguage', 'localStorage') @@ -34,7 +34,7 @@ export const useDefaultLocal = () => { } export const setupI18n = (app: App) => { - const locale = useDefaultLocal() + const locale = getDefaultLocal() const i18n = createI18n({ locale, @@ -63,7 +63,7 @@ export const useLanguageOptions = () => [ * * @remark 受打包体积影响. 如果有新的语言添加, 则需要手动引入对应语言包(https://www.naiveui.com/zh-CN/dark/docs/i18n) */ -export const useNaiveLocal = (key: string) => { +export const getNaiveLocal = (key: string) => { switch (key) { case 'zh-CN': return { @@ -91,10 +91,10 @@ export const useNaiveLocal = (key: string) => { * * @remark 获取默认语言包 */ -export const useDefaultNaiveLocal = () => { - const local = useDefaultLocal() +export const getDefaultNaiveLocal = () => { + const local = getDefaultLocal() - return useNaiveLocal(local) + return getNaiveLocal(local) } /** diff --git a/src/store/modules/setting.ts b/src/store/modules/setting.ts index f413b9bf..6054824c 100644 --- a/src/store/modules/setting.ts +++ b/src/store/modules/setting.ts @@ -1,4 +1,4 @@ -import { useNaiveLocal, useDefaultNaiveLocal } from '@/language/index' +import { getNaiveLocal, getDefaultNaiveLocal } from '@/language/index' export const useSetting = defineStore( 'setting', @@ -13,14 +13,14 @@ export const useSetting = defineStore( themeValue: false, // `true` 为黑夜主题, `false` 为白色主题 reloadRouteSwitch: true, // 刷新路由开关 menuTagSwitch: true, // 多标签页开关 - naiveLocal: useDefaultNaiveLocal(), // `naive ui` 语言包 + naiveLocal: getDefaultNaiveLocal(), // `naive ui` 语言包 }) const { locale } = useI18n() const updateLocale = (key: string) => { // TODO: 修改语言 locale.value = key - settingState.naiveLocal = useNaiveLocal(key) + settingState.naiveLocal = getNaiveLocal(key) } const changePrimaryColor = (value: string) => { diff --git a/src/types/index.d.ts b/src/types/index.d.ts index c257cb29..b71a325e 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -13,7 +13,9 @@ import type { import type { ECharts } from 'echarts/core' export global { - const __APP_INFO__: { + declare type Recordable = Record + + declare const __APP_INFO__: { pkg: { name: string version: string diff --git a/tsconfig.json b/tsconfig.json index 20e5baae..fdc7fcf6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,7 +25,7 @@ "@use-micro/*": ["src/micro/*"] }, "suppressImplicitAnyIndexErrors": true, - "types": ["@intlify/unplugin-vue-i18n/messages"] + "types": ["@intlify/unplugin-vue-i18n/messages", "naive-ui/volar"] }, "include": [ "src/**/*.ts", diff --git a/vite.config.ts b/vite.config.ts index d45e8bcf..0318dcb8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -63,7 +63,12 @@ export default defineConfig(async ({ mode }) => { defaultImport: 'component', // 默认以 `componetn` 形式导入 `svg` }), useSVGIcon(), - viteEslintPlugin, + viteEslintPlugin({ + failOnWarning: true, // 如果含有警告则构建失败 + failOnError: true, // 如果有错误则构建失败 + cache: true, // 缓存, 减少构建时间 + exclude: ['**/node_modules/**', 'vite-env.d.ts'], + }), vitePluginImp({ libList: [ {