diff --git a/apps/web-tdesign/package.json b/apps/web-tdesign/package.json index 533d1361..46918cd6 100644 --- a/apps/web-tdesign/package.json +++ b/apps/web-tdesign/package.json @@ -6,7 +6,7 @@ "repository": { "type": "git", "url": "git+https://github.com/vbenjs/vue-vben-admin.git", - "directory": "apps/web-naive" + "directory": "apps/web-tdesign" }, "license": "MIT", "author": { @@ -46,5 +46,5 @@ "tdesign-vue-next": "^1.17.1", "vue": "catalog:", "vue-router": "catalog:" - }, + } } diff --git a/apps/web-tdesign/src/adapter/component/index.ts b/apps/web-tdesign/src/adapter/component/index.ts index 0d1423f1..b4562d3a 100644 --- a/apps/web-tdesign/src/adapter/component/index.ts +++ b/apps/web-tdesign/src/adapter/component/index.ts @@ -8,7 +8,7 @@ import { defineAsyncComponent, defineComponent, h, ref } from 'vue'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { notification } from 'ant-design-vue'; +import { notification } from '#/adapter/tdesign'; /** * 通用组件共同的使用的基础组件,原先放在 adapter/form 内部,限制了使用范围,这里提取出来,方便其他地方使用 @@ -218,9 +218,9 @@ async function initComponentAdapter() { // 复制成功消息提示 copyPreferencesSuccess: (title, content) => { notification.success({ - description: content, - message: title, - placement: 'bottomRight', + title, + content, + placement: 'bottom-right', }); }, }); diff --git a/apps/web-tdesign/src/adapter/tdesign.ts b/apps/web-tdesign/src/adapter/tdesign.ts new file mode 100644 index 00000000..aa169bb5 --- /dev/null +++ b/apps/web-tdesign/src/adapter/tdesign.ts @@ -0,0 +1,9 @@ +import { + DialogPlugin, + MessagePlugin, + NotificationPlugin, +} from 'tdesign-vue-next'; + +export const message = MessagePlugin; +export const notification = NotificationPlugin; +export const dialog = DialogPlugin; diff --git a/apps/web-tdesign/src/adapter/vxe-table.ts b/apps/web-tdesign/src/adapter/vxe-table.ts index 7de2859d..43bd68af 100644 --- a/apps/web-tdesign/src/adapter/vxe-table.ts +++ b/apps/web-tdesign/src/adapter/vxe-table.ts @@ -4,7 +4,7 @@ import { h } from 'vue'; import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; -import { Button, Image } from 'ant-design-vue'; +import { Button, Image } from 'tdesign-vue-next'; import { useVbenForm } from './form'; @@ -52,7 +52,7 @@ setupVbenVxeTable({ const { props } = renderOpts; return h( Button, - { size: 'small', type: 'link' }, + { size: 'small', theme: 'primary', variant: 'text' }, { default: () => props?.text }, ); }, diff --git a/apps/web-tdesign/src/api/request.ts b/apps/web-tdesign/src/api/request.ts index 288dddd0..eb822148 100644 --- a/apps/web-tdesign/src/api/request.ts +++ b/apps/web-tdesign/src/api/request.ts @@ -13,7 +13,7 @@ import { } from '@vben/request'; import { useAccessStore } from '@vben/stores'; -import { message } from 'ant-design-vue'; +import { message } from '#/adapter/tdesign'; import { useAuthStore } from '#/store'; diff --git a/apps/web-tdesign/src/locales/index.ts b/apps/web-tdesign/src/locales/index.ts index 7f32bd18..ece11efd 100644 --- a/apps/web-tdesign/src/locales/index.ts +++ b/apps/web-tdesign/src/locales/index.ts @@ -1,5 +1,3 @@ -import type { Locale } from 'ant-design-vue/es/locale'; - import type { App } from 'vue'; import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; @@ -13,12 +11,8 @@ import { } from '@vben/locales'; import { preferences } from '@vben/preferences'; -import antdEnLocale from 'ant-design-vue/es/locale/en_US'; -import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN'; import dayjs from 'dayjs'; -const antdLocale = ref(antdDefaultLocale); - const modules = import.meta.glob('./langs/**/*.json'); const localesMap = loadLocalesMapFromDir( @@ -43,7 +37,7 @@ async function loadMessages(lang: SupportedLanguagesType) { * @param lang */ async function loadThirdPartyMessage(lang: SupportedLanguagesType) { - await Promise.all([loadAntdLocale(lang), loadDayjsLocale(lang)]); + await loadDayjsLocale(lang); } /** @@ -73,23 +67,6 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) { } } -/** - * 加载antd的语言包 - * @param lang - */ -async function loadAntdLocale(lang: SupportedLanguagesType) { - switch (lang) { - case 'en-US': { - antdLocale.value = antdEnLocale; - break; - } - case 'zh-CN': { - antdLocale.value = antdDefaultLocale; - break; - } - } -} - async function setupI18n(app: App, options: LocaleSetupOptions = {}) { await coreSetup(app, { defaultLocale: preferences.app.locale, @@ -99,4 +76,4 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) { }); } -export { $t, antdLocale, setupI18n }; +export { $t, setupI18n }; diff --git a/apps/web-tdesign/src/router/access.ts b/apps/web-tdesign/src/router/access.ts index 3a48be23..617549fb 100644 --- a/apps/web-tdesign/src/router/access.ts +++ b/apps/web-tdesign/src/router/access.ts @@ -6,7 +6,7 @@ import type { import { generateAccessible } from '@vben/access'; import { preferences } from '@vben/preferences'; -import { message } from 'ant-design-vue'; +import { message } from '#/adapter/tdesign'; import { getAllMenusApi } from '#/api'; import { BasicLayout, IFrameView } from '#/layouts'; @@ -27,7 +27,7 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) { fetchMenuListAsync: async () => { message.loading({ content: `${$t('common.loadingMenu')}...`, - duration: 1.5, + duration: 1500, }); return await getAllMenusApi(); }, diff --git a/apps/web-tdesign/src/store/auth.ts b/apps/web-tdesign/src/store/auth.ts index 312a74da..38c74e32 100644 --- a/apps/web-tdesign/src/store/auth.ts +++ b/apps/web-tdesign/src/store/auth.ts @@ -7,7 +7,7 @@ import { LOGIN_PATH } from '@vben/constants'; import { preferences } from '@vben/preferences'; import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; -import { notification } from 'ant-design-vue'; +import { notification } from '#/adapter/tdesign'; import { defineStore } from 'pinia'; import { getAccessCodesApi, getUserInfoApi, loginApi, logoutApi } from '#/api'; @@ -61,9 +61,9 @@ export const useAuthStore = defineStore('auth', () => { if (userInfo?.realName) { notification.success({ - description: `${$t('authentication.loginSuccessDesc')}:${userInfo?.realName}`, - duration: 3, - message: $t('authentication.loginSuccess'), + title: $t('authentication.loginSuccess'), + content: `${$t('authentication.loginSuccessDesc')}:${userInfo?.realName}`, + duration: 3000, }); } } diff --git a/apps/web-tdesign/src/views/demos/antd/index.vue b/apps/web-tdesign/src/views/demos/antd/index.vue index b3b05cc1..f44f96e5 100644 --- a/apps/web-tdesign/src/views/demos/antd/index.vue +++ b/apps/web-tdesign/src/views/demos/antd/index.vue @@ -1,7 +1,9 @@ @@ -35,20 +36,20 @@ function notify(type: NotificationType) {