Skip to content

Commit 749c55e

Browse files
committed
refactor!: 重构多个子包
- 移除 unbuild --stub 模式 - faToast -> useFaToast
1 parent 40cab5e commit 749c55e

372 files changed

Lines changed: 807 additions & 2266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/core-ant-design-vue/src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function handleError(error: any) {
5151
useAppAccountStore().requestLogout()
5252
}
5353
else {
54-
faToast.error('Error', {
54+
useFaToast().error('Error', {
5555
description: error.message,
5656
})
5757
}
@@ -70,7 +70,7 @@ api.interceptors.response.use(
7070
if (typeof response.data === 'object') {
7171
if (response.data.status === 1) {
7272
if (response.data.error) {
73-
faToast.warning('Warning', {
73+
useFaToast().warning('Warning', {
7474
description: response.data.error,
7575
})
7676
return Promise.reject(response.data)

apps/core-ant-design-vue/src/components/AppAccountForm/edit-password.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const form = useForm({
3232
const onSubmit = form.handleSubmit((values) => {
3333
loading.value = true
3434
appAccountStore.editPassword(values).then(async () => {
35-
faToast.success('模拟修改成功,请重新登录')
35+
useFaToast().success('模拟修改成功,请重新登录')
3636
appAccountStore.logout()
3737
}).finally(() => {
3838
loading.value = false

apps/core-ant-design-vue/src/composables/app/tabbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ export function useAppTabbar() {
8080
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
8181
if (index < 0) {
8282
flag = false
83-
!checkOnly && faToast.warning('关闭的标签页不存在', {
83+
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
8484
position: 'top-center',
8585
})
8686
}
8787
else if (appTabbarStore.list.length <= 1) {
8888
flag = false
89-
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
89+
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
9090
position: 'top-center',
9191
})
9292
}

apps/core-ant-design-vue/src/layouts/components/Topbar/Tabbar/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
7272
function tabbarScrollTip() {
7373
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
7474
localStorage.setItem('tabbarScrollTip', '')
75-
const tips = faToast.info('温馨提示', {
75+
const tips = useFaToast().info('温馨提示', {
7676
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
7777
position: 'top-center',
7878
duration: Infinity,
7979
action: {
8080
label: '知道了',
81-
onClick: () => faToast.dismiss(tips),
81+
onClick: () => useFaToast().dismiss(tips),
8282
},
8383
})
8484
}

apps/core-ant-design-vue/src/layouts/components/views/link.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defineOptions({
88
const route = useRoute()
99
const { copy, copied } = useClipboard()
1010
watch(copied, (val) => {
11-
val && faToast.success('复制成功')
11+
val && useFaToast().success('复制成功')
1212
})
1313
1414
function open() {

apps/core-ant-design-vue/src/types/auto-imports.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ declare global {
1616
const defineComponent: typeof import('vue').defineComponent
1717
const defineStore: typeof import('pinia').defineStore
1818
const effectScope: typeof import('vue').effectScope
19-
const faToast: typeof import('@fantastic-admin/components').faToast
2019
const getActivePinia: typeof import('pinia').getActivePinia
2120
const getCurrentInstance: typeof import('vue').getCurrentInstance
2221
const getCurrentScope: typeof import('vue').getCurrentScope
@@ -84,6 +83,7 @@ declare global {
8483
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
8584
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
8685
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
86+
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
8787
const useId: typeof import('vue').useId
8888
const useLink: typeof import('vue-router').useLink
8989
const useModel: typeof import('vue').useModel

apps/core-ant-design-vue/vite.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
4747
},
4848
plugins: createVitePlugins(mode, command === 'build'),
4949
optimizeDeps: {
50-
exclude: ['@fantastic-admin/components'],
50+
exclude: [
51+
'@fantastic-admin/components',
52+
'@fantastic-admin/composables',
53+
],
5154
},
5255
resolve: {
5356
alias: {

apps/core-antdv-next/src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function handleError(error: any) {
5151
useAppAccountStore().requestLogout()
5252
}
5353
else {
54-
faToast.error('Error', {
54+
useFaToast().error('Error', {
5555
description: error.message,
5656
})
5757
}
@@ -70,7 +70,7 @@ api.interceptors.response.use(
7070
if (typeof response.data === 'object') {
7171
if (response.data.status === 1) {
7272
if (response.data.error) {
73-
faToast.warning('Warning', {
73+
useFaToast().warning('Warning', {
7474
description: response.data.error,
7575
})
7676
return Promise.reject(response.data)

apps/core-antdv-next/src/components/AppAccountForm/edit-password.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const form = useForm({
3232
const onSubmit = form.handleSubmit((values) => {
3333
loading.value = true
3434
appAccountStore.editPassword(values).then(async () => {
35-
faToast.success('模拟修改成功,请重新登录')
35+
useFaToast().success('模拟修改成功,请重新登录')
3636
appAccountStore.logout()
3737
}).finally(() => {
3838
loading.value = false

apps/core-antdv-next/src/composables/app/tabbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ export function useAppTabbar() {
8080
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
8181
if (index < 0) {
8282
flag = false
83-
!checkOnly && faToast.warning('关闭的标签页不存在', {
83+
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
8484
position: 'top-center',
8585
})
8686
}
8787
else if (appTabbarStore.list.length <= 1) {
8888
flag = false
89-
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
89+
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
9090
position: 'top-center',
9191
})
9292
}

0 commit comments

Comments
 (0)