mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 11:34:10 +08:00
refactor!: 重构多个子包
- 移除 unbuild --stub 模式 - faToast -> useFaToast
This commit is contained in:
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -84,6 +83,7 @@ declare global {
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -47,7 +47,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -51,7 +51,7 @@ function handleError(error: any) {
|
||||
useAppAccountStore().requestLogout()
|
||||
}
|
||||
else {
|
||||
faToast.error('Error', {
|
||||
useFaToast().error('Error', {
|
||||
description: error.message,
|
||||
})
|
||||
}
|
||||
@@ -70,7 +70,7 @@ api.interceptors.response.use(
|
||||
if (typeof response.data === 'object') {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.error) {
|
||||
faToast.warning('Warning', {
|
||||
useFaToast().warning('Warning', {
|
||||
description: response.data.error,
|
||||
})
|
||||
return Promise.reject(response.data)
|
||||
|
||||
@@ -32,7 +32,7 @@ const form = useForm({
|
||||
const onSubmit = form.handleSubmit((values) => {
|
||||
loading.value = true
|
||||
appAccountStore.editPassword(values).then(async () => {
|
||||
faToast.success('模拟修改成功,请重新登录')
|
||||
useFaToast().success('模拟修改成功,请重新登录')
|
||||
appAccountStore.logout()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
|
||||
@@ -80,13 +80,13 @@ export function useAppTabbar() {
|
||||
const index = appTabbarStore.list.findIndex(item => item.tabId === tabId)
|
||||
if (index < 0) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('关闭的标签页不存在', {
|
||||
!checkOnly && useFaToast().warning('关闭的标签页不存在', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else if (appTabbarStore.list.length <= 1) {
|
||||
flag = false
|
||||
!checkOnly && faToast.warning('当前只有一个标签页,不可关闭', {
|
||||
!checkOnly && useFaToast().warning('当前只有一个标签页,不可关闭', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ watch(() => route, (val) => {
|
||||
function tabbarScrollTip() {
|
||||
if (tabContainerRef.value?.$el.clientWidth > (tabsRef.value?.ref?.$el.clientWidth ?? 0) && !localStorage.has('tabbarScrollTip')) {
|
||||
localStorage.setItem('tabbarScrollTip', '')
|
||||
const tips = faToast.info('温馨提示', {
|
||||
const tips = useFaToast().info('温馨提示', {
|
||||
description: '标签栏数量超过展示区域范围,可以将鼠标移到标签栏上,通过鼠标滚轮滑动浏览',
|
||||
position: 'top-center',
|
||||
duration: Infinity,
|
||||
action: {
|
||||
label: '知道了',
|
||||
onClick: () => faToast.dismiss(tips),
|
||||
onClick: () => useFaToast().dismiss(tips),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
const { copy, copied } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success('复制成功')
|
||||
val && useFaToast().success('复制成功')
|
||||
})
|
||||
|
||||
function open() {
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@ declare global {
|
||||
const defineComponent: typeof import('vue').defineComponent
|
||||
const defineStore: typeof import('pinia').defineStore
|
||||
const effectScope: typeof import('vue').effectScope
|
||||
const faToast: typeof import('@fantastic-admin/components').faToast
|
||||
const getActivePinia: typeof import('pinia').getActivePinia
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const getCurrentScope: typeof import('vue').getCurrentScope
|
||||
@@ -83,8 +82,8 @@ declare global {
|
||||
const useCssVars: typeof import('vue').useCssVars
|
||||
const useFaDrawer: typeof import('@fantastic-admin/components').useFaDrawer
|
||||
const useFaImagePreview: typeof import('@fantastic-admin/components').useFaImagePreview
|
||||
const useFaLoading: typeof import('@fantastic-admin/components').useFaLoading
|
||||
const useFaModal: typeof import('@fantastic-admin/components').useFaModal
|
||||
const useFaToast: typeof import('@fantastic-admin/components').useFaToast
|
||||
const useId: typeof import('vue').useId
|
||||
const useLink: typeof import('vue-router').useLink
|
||||
const useModel: typeof import('vue').useModel
|
||||
|
||||
@@ -24,24 +24,24 @@ function goTest() {
|
||||
}
|
||||
function permissionCheck(permissions: string | string[]) {
|
||||
if (auth(permissions)) {
|
||||
faToast.success('校验通过', {
|
||||
useFaToast().success('校验通过', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else {
|
||||
faToast.error('校验不通过', {
|
||||
useFaToast().error('校验不通过', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
}
|
||||
function permissionCheck2(permissions: string[]) {
|
||||
if (authAll(permissions)) {
|
||||
faToast.success('校验通过', {
|
||||
useFaToast().success('校验通过', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
else {
|
||||
faToast.error('校验不通过', {
|
||||
useFaToast().error('校验不通过', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
function handleClick(text: string) {
|
||||
faToast(text)
|
||||
useFaToast()(text)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
function handleClick(text: string) {
|
||||
faToast(text)
|
||||
useFaToast()(text)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
function handleClick(text: string) {
|
||||
faToast(text)
|
||||
useFaToast()(text)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
function handleClick(text: string) {
|
||||
faToast(text)
|
||||
useFaToast()(text)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const modal = shallowRef(false)
|
||||
|
||||
function handleClick(text: string) {
|
||||
faToast(text)
|
||||
useFaToast()(text)
|
||||
}
|
||||
|
||||
const items = [
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { FileItem } from '@fantastic-admin/components'
|
||||
const files = ref<FileItem[]>([])
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('模拟上传成功')
|
||||
useFaToast().success('模拟上传成功')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -10,22 +10,22 @@ function beforeUpload(file: File) {
|
||||
const isLt200K = file.size <= 200 * 1024
|
||||
|
||||
if (!isPng) {
|
||||
faToast.error('只能上传 PNG 文件')
|
||||
useFaToast().error('只能上传 PNG 文件')
|
||||
return false
|
||||
}
|
||||
if (!isLt200K) {
|
||||
faToast.error('文件大小不能超过 200KB')
|
||||
useFaToast().error('文件大小不能超过 200KB')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('模拟上传成功')
|
||||
useFaToast().success('模拟上传成功')
|
||||
}
|
||||
|
||||
function handleClick(fileItem: FileItem) {
|
||||
faToast.info(fileItem.name, {
|
||||
useFaToast().info(fileItem.name, {
|
||||
description: fileItem.url,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { FileItem } from '@fantastic-admin/components'
|
||||
const files = ref<FileItem[]>([])
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('模拟上传成功')
|
||||
useFaToast().success('模拟上传成功')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ async function httpRequest({ file, onProgress }: FileUploadRequestOptions) {
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('自定义上传完成')
|
||||
useFaToast().success('自定义上传完成')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const files = ref<string[]>([])
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('模拟上传成功')
|
||||
useFaToast().success('模拟上传成功')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const files = ref<string[]>(['https://fantastic-admin.hurui.me/logo.svg'])
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('模拟上传成功')
|
||||
useFaToast().success('模拟上传成功')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,18 +3,18 @@ const files = ref<string[]>([])
|
||||
|
||||
function beforeUpload(file: File) {
|
||||
if (!file.type.startsWith('image/')) {
|
||||
faToast.error('请选择图片文件')
|
||||
useFaToast().error('请选择图片文件')
|
||||
return false
|
||||
}
|
||||
if (file.size > 200 * 1024) {
|
||||
faToast.error('图片大小不能超过 200KB')
|
||||
useFaToast().error('图片大小不能超过 200KB')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('模拟上传成功')
|
||||
useFaToast().success('模拟上传成功')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ async function httpRequest({ file, onProgress }: UploadRequestOptions) {
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
faToast.success('自定义上传完成')
|
||||
useFaToast().success('自定义上传完成')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const input = ref('')
|
||||
|
||||
function handleComplete() {
|
||||
faToast.info(input.value)
|
||||
useFaToast().info(input.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ function showModalInfo() {
|
||||
title: '温馨提醒',
|
||||
content: '这是 info 弹窗',
|
||||
onConfirm: () => {
|
||||
faToast.info('你点了确定')
|
||||
useFaToast().info('你点了确定')
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -13,7 +13,7 @@ function showModalSuccess() {
|
||||
title: '温馨提醒',
|
||||
content: '这是 success 弹窗',
|
||||
onConfirm: () => {
|
||||
faToast.info('你点了确定')
|
||||
useFaToast().info('你点了确定')
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -22,7 +22,7 @@ function showModalWarning() {
|
||||
title: '温馨提醒',
|
||||
content: '这是 warning 弹窗',
|
||||
onConfirm: () => {
|
||||
faToast.info('你点了确定')
|
||||
useFaToast().info('你点了确定')
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -31,7 +31,7 @@ function showModalError() {
|
||||
title: '温馨提醒',
|
||||
content: '这是 confirm 弹窗',
|
||||
onConfirm: () => {
|
||||
faToast.info('你点了确定')
|
||||
useFaToast().info('你点了确定')
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -40,7 +40,7 @@ function showModalConfirm() {
|
||||
title: '温馨提醒',
|
||||
content: '这是 confirm 弹窗',
|
||||
onConfirm: () => {
|
||||
faToast.info('你点了确定')
|
||||
useFaToast().info('你点了确定')
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -80,11 +80,11 @@ function showModalPromiseConfirm() {
|
||||
if (action === 'confirm') {
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
if (Math.random() > 0.5) {
|
||||
faToast.success('成功了!')
|
||||
useFaToast().success('成功了!')
|
||||
done()
|
||||
}
|
||||
else {
|
||||
faToast.error('失败了!')
|
||||
useFaToast().error('失败了!')
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -9,7 +9,7 @@ const search = ref({
|
||||
})
|
||||
|
||||
function onToggle(fold: boolean) {
|
||||
faToast(fold ? '收起' : '展开')
|
||||
useFaToast()(fold ? '收起' : '展开')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
function showToast(type?: 'success' | 'error' | 'info' | 'warning' | 'action' | 'loading1' | 'loading2') {
|
||||
if (type) {
|
||||
if (type === 'loading1') {
|
||||
faToast.promise(() => new Promise((resolve) => {
|
||||
useFaToast().promise(() => new Promise((resolve) => {
|
||||
setTimeout(resolve, 2000)
|
||||
}), {
|
||||
loading: '加载中',
|
||||
@@ -13,13 +13,13 @@ function showToast(type?: 'success' | 'error' | 'info' | 'warning' | 'action' |
|
||||
})
|
||||
}
|
||||
else if (type === 'loading2') {
|
||||
const loading = faToast.loading('加载中', {
|
||||
const loading = useFaToast().loading('加载中', {
|
||||
position: 'top-right',
|
||||
duration: Infinity,
|
||||
})
|
||||
setTimeout(() => {
|
||||
faToast.dismiss(loading)
|
||||
faToast('Fantastic-admin 杰出的管理系统框架', {
|
||||
useFaToast().dismiss(loading)
|
||||
useFaToast()('Fantastic-admin 杰出的管理系统框架', {
|
||||
description: '开箱即用,提供舒适开发体验',
|
||||
position: 'top-right',
|
||||
duration: 3000,
|
||||
@@ -27,20 +27,20 @@ function showToast(type?: 'success' | 'error' | 'info' | 'warning' | 'action' |
|
||||
}, 2000)
|
||||
}
|
||||
else if (type === 'action') {
|
||||
faToast('Fantastic-admin 杰出的管理系统框架', {
|
||||
useFaToast()('Fantastic-admin 杰出的管理系统框架', {
|
||||
description: '开箱即用,提供舒适开发体验',
|
||||
position: 'top-right',
|
||||
duration: 3000,
|
||||
action: {
|
||||
label: 'Undo',
|
||||
onClick: () => {
|
||||
faToast.success('操作成功')
|
||||
useFaToast().success('操作成功')
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
else {
|
||||
faToast[type]('Fantastic-admin 杰出的管理系统框架', {
|
||||
useFaToast()[type]('Fantastic-admin 杰出的管理系统框架', {
|
||||
description: '开箱即用,提供舒适开发体验',
|
||||
position: 'top-right',
|
||||
duration: 3000,
|
||||
@@ -48,7 +48,7 @@ function showToast(type?: 'success' | 'error' | 'info' | 'warning' | 'action' |
|
||||
}
|
||||
}
|
||||
else {
|
||||
faToast('Fantastic-admin 杰出的管理系统框架', {
|
||||
useFaToast()('Fantastic-admin 杰出的管理系统框架', {
|
||||
description: '开箱即用,提供舒适开发体验',
|
||||
position: 'top-right',
|
||||
duration: 3000,
|
||||
|
||||
@@ -476,7 +476,7 @@ const dialog = ref({
|
||||
})
|
||||
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success(`复制成功:${text.value}`)
|
||||
val && useFaToast().success(`复制成功:${text.value}`)
|
||||
})
|
||||
|
||||
function test(index: number) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useClipboard, useDebounceFn, useThrottleFn } from '@vueuse/core'
|
||||
|
||||
function message() {
|
||||
faToast.success('Toast')
|
||||
useFaToast().success('Toast')
|
||||
}
|
||||
|
||||
const debounce = useDebounceFn(() => {
|
||||
@@ -16,7 +16,7 @@ const throttle = useThrottleFn(() => {
|
||||
const input = ref('test')
|
||||
const { text, copy, copied, isSupported } = useClipboard()
|
||||
watch(copied, (val) => {
|
||||
val && faToast.success(text.value)
|
||||
val && useFaToast().success(text.value)
|
||||
})
|
||||
|
||||
function open(url: string) {
|
||||
|
||||
@@ -7,7 +7,7 @@ const { copy, isSupported } = useClipboard()
|
||||
function onCopy(iconName: string) {
|
||||
if (isSupported.value) {
|
||||
copy(`<FaIcon name="i-${iconName}" />`)
|
||||
faToast.success('复制成功', {
|
||||
useFaToast().success('复制成功', {
|
||||
description: `<FaIcon name="i-${iconName}" />`,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ const { copy, copied, isSupported } = useClipboard()
|
||||
|
||||
watch(copied, (val) => {
|
||||
if (val) {
|
||||
faToast.success('复制成功', {
|
||||
useFaToast().success('复制成功', {
|
||||
position: 'top-center',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ function handleGenerate() {
|
||||
esignRef.value.generate().then((res: string) => {
|
||||
result.value = res
|
||||
}).catch(() => {
|
||||
faToast.warning('画板为空,无法生成图片')
|
||||
useFaToast().warning('画板为空,无法生成图片')
|
||||
})
|
||||
}
|
||||
function handleDownload() {
|
||||
|
||||
@@ -47,13 +47,13 @@ defineExpose({
|
||||
if (valid) {
|
||||
if (form.value.id === '') {
|
||||
apiStandardModule.create(form.value).then(() => {
|
||||
faToast.success('新增成功')
|
||||
useFaToast().success('新增成功')
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
else {
|
||||
apiStandardModule.edit(form.value).then(() => {
|
||||
faToast.success('编辑成功')
|
||||
useFaToast().success('编辑成功')
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ function onDel(row: any) {
|
||||
onConfirm: () => {
|
||||
apiStandardModule.delete(row.id).then(() => {
|
||||
getDataList()
|
||||
faToast.success('删除成功')
|
||||
useFaToast().success('删除成功')
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -48,7 +48,10 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
plugins: createVitePlugins(mode, command === 'build'),
|
||||
optimizeDeps: {
|
||||
exclude: ['@fantastic-admin/components'],
|
||||
exclude: [
|
||||
'@fantastic-admin/components',
|
||||
'@fantastic-admin/composables',
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
@@ -53,6 +53,7 @@ export default function createVitePlugins(mode: string, isBuild = false) {
|
||||
FantasticAdminComposablesAutoImports,
|
||||
],
|
||||
dts: './src/types/auto-imports.d.ts',
|
||||
dtsMode: 'overwrite',
|
||||
dirs: [
|
||||
'./src/store/modules/**/*',
|
||||
'./src/composables/**/*',
|
||||
@@ -65,6 +66,7 @@ export default function createVitePlugins(mode: string, isBuild = false) {
|
||||
'src/components/*/index.vue',
|
||||
],
|
||||
dts: './src/types/components.d.ts',
|
||||
syncMode: 'overwrite',
|
||||
resolvers: [
|
||||
FantasticAdminComponentsResolver(),
|
||||
],
|
||||
|
||||
+1
-2
@@ -16,7 +16,7 @@
|
||||
"lint:eslint": "eslint . --cache --fix",
|
||||
"lint:stylelint": "stylelint \"{apps,packages}/**/*.{css,scss,vue}\" --cache --fix",
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"postinstall": "pnpm -r run stub --if-present && simple-git-hooks",
|
||||
"postinstall": "simple-git-hooks",
|
||||
"taze": "taze minor -wIr",
|
||||
"commit": "git cz",
|
||||
"release": "bumpp"
|
||||
@@ -45,7 +45,6 @@
|
||||
"taze": "catalog:",
|
||||
"tsx": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"unbuild": "catalog:",
|
||||
"unocss": "catalog:",
|
||||
"unocss-preset-animations": "catalog:"
|
||||
},
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
export {}
|
||||
|
||||
declare global {
|
||||
const computed: typeof import('vue').computed
|
||||
const createVNode: typeof import('vue').createVNode
|
||||
const getCurrentInstance: typeof import('vue').getCurrentInstance
|
||||
const h: typeof import('vue').h
|
||||
const isVNode: typeof import('vue').isVNode
|
||||
const nextTick: typeof import('vue').nextTick
|
||||
const onActivated: typeof import('vue').onActivated
|
||||
const onDeactivated: typeof import('vue').onDeactivated
|
||||
const onBeforeUnmount: typeof import('vue').onBeforeUnmount
|
||||
const onMounted: typeof import('vue').onMounted
|
||||
const onUnmounted: typeof import('vue').onUnmounted
|
||||
const reactive: typeof import('vue').reactive
|
||||
const ref: typeof import('vue').ref
|
||||
const shallowRef: typeof import('vue').shallowRef
|
||||
const toRef: typeof import('vue').toRef
|
||||
const unref: typeof import('vue').unref
|
||||
const useId: typeof import('vue').useId
|
||||
const useSlots: typeof import('vue').useSlots
|
||||
const useTemplateRef: typeof import('vue').useTemplateRef
|
||||
const watch: typeof import('vue').watch
|
||||
const watchEffect: typeof import('vue').watchEffect
|
||||
|
||||
const faToast: typeof import('./index').faToast
|
||||
const useFaDrawer: typeof import('./index').useFaDrawer
|
||||
const useFaImagePreview: typeof import('./index').useFaImagePreview
|
||||
const useFaModal: typeof import('./index').useFaModal
|
||||
}
|
||||
|
||||
declare global {
|
||||
// @ts-ignore
|
||||
export type { ComponentPublicInstance, VNode } from 'vue'
|
||||
import('vue')
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { defineBuildConfig } from 'unbuild'
|
||||
|
||||
export default defineBuildConfig({
|
||||
entries: ['./resolver'],
|
||||
declaration: false,
|
||||
clean: true,
|
||||
})
|
||||
Vendored
-47
@@ -1,47 +0,0 @@
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
FaAlert: typeof import('./index')['FaAlert']
|
||||
FaAvatar: typeof import('./index')['FaAvatar']
|
||||
FaButton: typeof import('./index')['FaButton']
|
||||
FaButtonGroup: typeof import('./index')['FaButtonGroup']
|
||||
FaCard: typeof import('./index')['FaCard']
|
||||
FaCheckbox: typeof import('./index')['FaCheckbox']
|
||||
FaCheckboxGroup: typeof import('./index')['FaCheckboxGroup']
|
||||
FaCollapsible: typeof import('./index')['FaCollapsible']
|
||||
FaContextMenu: typeof import('./index')['FaContextMenu']
|
||||
FaDivider: typeof import('./index')['FaDivider']
|
||||
FaDrawer: typeof import('./index')['FaDrawer']
|
||||
FaDropdown: typeof import('./index')['FaDropdown']
|
||||
FaFileUpload: typeof import('./index')['FaFileUpload']
|
||||
FaFixedBar: typeof import('./index')['FaFixedBar']
|
||||
FaHoverCard: typeof import('./index')['FaHoverCard']
|
||||
FaIcon: typeof import('./index')['FaIcon']
|
||||
FaImagePreview: typeof import('./index')['FaImagePreview']
|
||||
FaImageUpload: typeof import('./index')['FaImageUpload']
|
||||
FaInput: typeof import('./index')['FaInput']
|
||||
FaInputOTP: typeof import('./index')['FaInputOTP']
|
||||
FaKbd: typeof import('./index')['FaKbd']
|
||||
FaKbdGroup: typeof import('./index')['FaKbdGroup']
|
||||
FaLabel: typeof import('./index')['FaLabel']
|
||||
FaModal: typeof import('./index')['FaModal']
|
||||
FaNumberField: typeof import('./index')['FaNumberField']
|
||||
FaPageHeader: typeof import('./index')['FaPageHeader']
|
||||
FaPageMain: typeof import('./index')['FaPageMain']
|
||||
FaPasswordStrength: typeof import('./index')['FaPasswordStrength']
|
||||
FaPopover: typeof import('./index')['FaPopover']
|
||||
FaProgress: typeof import('./index')['FaProgress']
|
||||
FaRadioGroup: typeof import('./index')['FaRadioGroup']
|
||||
FaScrollArea: typeof import('./index')['FaScrollArea']
|
||||
FaSearchBar: typeof import('./index')['FaSearchBar']
|
||||
FaSelect: typeof import('./index')['FaSelect']
|
||||
FaSlider: typeof import('./index')['FaSlider']
|
||||
FaSwitch: typeof import('./index')['FaSwitch']
|
||||
FaTabs: typeof import('./index')['FaTabs']
|
||||
FaTextarea: typeof import('./index')['FaTextarea']
|
||||
FaToast: typeof import('./index')['FaToast']
|
||||
FaTooltip: typeof import('./index')['FaTooltip']
|
||||
FaTrend: typeof import('./index')['FaTrend']
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
@@ -1,48 +0,0 @@
|
||||
export { default as FaAlert } from './src/alert/index.vue'
|
||||
export { default as FaAvatar } from './src/avatar/index.vue'
|
||||
export { default as FaButtonGroup } from './src/button-group/index.vue'
|
||||
export { default as FaButton } from './src/button/index.vue'
|
||||
export { default as FaCard } from './src/card/index.vue'
|
||||
export { default as FaCheckboxGroup } from './src/checkbox-group/index.vue'
|
||||
export { default as FaCheckbox } from './src/checkbox/index.vue'
|
||||
export { default as FaCollapsible } from './src/collapsible/index.vue'
|
||||
export { default as FaContextMenu } from './src/context-menu/index.vue'
|
||||
export { default as FaDivider } from './src/divider/index.vue'
|
||||
export * from './src/drawer/index'
|
||||
export { default as FaDrawer } from './src/drawer/index.vue'
|
||||
export { default as FaDropdown } from './src/dropdown/index.vue'
|
||||
export { default as FaFileUpload } from './src/file-upload/index.vue'
|
||||
export type { FileItem, FileUploadRequestOptions } from './src/file-upload/index.vue'
|
||||
export { default as FaFixedBar } from './src/fixed-bar/index.vue'
|
||||
export { default as FaHoverCard } from './src/hover-card/index.vue'
|
||||
export { default as FaIcon } from './src/icon/index.vue'
|
||||
export * from './src/image-preview/index'
|
||||
export { default as FaImagePreview } from './src/image-preview/index.vue'
|
||||
export type { UploadRequestOptions } from './src/image-upload/index.vue'
|
||||
export { default as FaImageUpload } from './src/image-upload/index.vue'
|
||||
export { default as FaInputOTP } from './src/input-otp/index.vue'
|
||||
export { default as FaInput } from './src/input/index.vue'
|
||||
export { default as FaKbdGroup } from './src/kbd-group/index.vue'
|
||||
export { default as FaKbd } from './src/kbd/index.vue'
|
||||
export { default as FaLabel } from './src/label/index.vue'
|
||||
export * from './src/modal/index'
|
||||
export { default as FaModal } from './src/modal/index.vue'
|
||||
export { default as FaNumberField } from './src/number-field/index.vue'
|
||||
export { default as FaPageHeader } from './src/page-header/index.vue'
|
||||
export { default as FaPageMain } from './src/page-main/index.vue'
|
||||
export { default as FaPagination } from './src/pagination/index.vue'
|
||||
export { default as FaPasswordStrength } from './src/password-strength/index.vue'
|
||||
export { default as FaPopover } from './src/popover/index.vue'
|
||||
export { default as FaProgress } from './src/progress/index.vue'
|
||||
export { default as FaRadioGroup } from './src/radio-group/index.vue'
|
||||
export { default as FaScrollArea } from './src/scroll-area/index.vue'
|
||||
export { default as FaSearchBar } from './src/search-bar/index.vue'
|
||||
export { default as FaSelect } from './src/select/index.vue'
|
||||
export { default as FaSlider } from './src/slider/index.vue'
|
||||
export { default as FaSwitch } from './src/switch/index.vue'
|
||||
export { default as FaTabs } from './src/tabs/index.vue'
|
||||
export { default as FaTextarea } from './src/textarea/index.vue'
|
||||
export * from './src/toast/index'
|
||||
export { default as FaToast } from './src/toast/index.vue'
|
||||
export { default as FaTooltip } from './src/tooltip/index.vue'
|
||||
export { default as FaTrend } from './src/trend/index.vue'
|
||||
@@ -2,15 +2,12 @@
|
||||
"name": "@fantastic-admin/components",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
"./resolver": {
|
||||
"types": "./resolver.ts",
|
||||
"import": "./dist/resolver.mjs"
|
||||
}
|
||||
"imports": {
|
||||
"#utils": "./src/utils.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"stub": "pnpm unbuild --stub"
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./resolver": "./resolver.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vueuse/components": "catalog:",
|
||||
@@ -18,8 +15,7 @@
|
||||
"unplugin-auto-import": "catalog:",
|
||||
"unplugin-vue-components": "catalog:",
|
||||
"vite": "catalog:",
|
||||
"vue": "catalog:",
|
||||
"vue-router": "catalog:"
|
||||
"vue": "catalog:"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"unplugin-auto-import": {
|
||||
@@ -41,6 +37,5 @@
|
||||
"tailwind-merge": "catalog:",
|
||||
"vue-input-otp": "catalog:",
|
||||
"vue-sonner": "catalog:"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { ComponentResolver, TypeImport } from 'unplugin-vue-components'
|
||||
const COMPONENT_PREFIX = 'Fa'
|
||||
const PACKAGE_NAME = '@fantastic-admin/components'
|
||||
|
||||
const COMPONENT_NAMES = [
|
||||
const BASIC_COMPONENT_NAMES = [
|
||||
'FaAlert',
|
||||
'FaAvatar',
|
||||
'FaButton',
|
||||
@@ -49,11 +49,15 @@ const COMPONENT_NAMES = [
|
||||
'FaTrend',
|
||||
] as const
|
||||
|
||||
const COMPONENT_NAMES = [
|
||||
...BASIC_COMPONENT_NAMES,
|
||||
] as const
|
||||
|
||||
const AUTO_IMPORT_NAMES = [
|
||||
'useFaDrawer',
|
||||
'useFaImagePreview',
|
||||
'useFaModal',
|
||||
'faToast',
|
||||
'useFaToast',
|
||||
] as const
|
||||
|
||||
export const ComponentsAutoImports: ImportsMap = {
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { AlertVariants } from '.'
|
||||
import { cn } from '#utils'
|
||||
import { alertVariants } from '.'
|
||||
import { cn } from '../../../utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '../../../utils'
|
||||
import { cn } from '#utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '../../../utils'
|
||||
import { cn } from '#utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { AlertVariants } from './alert'
|
||||
import Icon from '../icon/index.vue'
|
||||
import { Alert, AlertDescription, AlertTitle } from './alert'
|
||||
|
||||
defineOptions({
|
||||
name: 'FaAlert',
|
||||
name: 'BuiltInAlert',
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -28,7 +29,7 @@ defineSlots<{
|
||||
props.class,
|
||||
]"
|
||||
>
|
||||
<FaIcon v-if="icon" data-slot="alert-icon" :name="icon" />
|
||||
<Icon v-if="icon" data-slot="alert-icon" :name="icon" />
|
||||
<AlertTitle v-if="title">
|
||||
{{ title }}
|
||||
</AlertTitle>
|
||||
Executable → Regular
+1
-1
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { AvatarRoot } from 'reka-ui'
|
||||
import { cn } from '../../../utils'
|
||||
import { cn } from '#utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
Executable → Regular
+1
-1
@@ -3,7 +3,7 @@ import type { AvatarFallbackProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { AvatarFallback } from 'reka-ui'
|
||||
import { cn } from '../../../utils'
|
||||
import { cn } from '#utils'
|
||||
|
||||
const props = defineProps<AvatarFallbackProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
Executable → Regular
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user