mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 13:01:14 +08:00
Merge branch 'develop' of github.com:Tencent/tdesign-vue-next-starter into main
This commit is contained in:
commit
16c2dc46e9
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tdesign-vue-next-starter",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1",
|
||||
"scripts": {
|
||||
"dev:mock": "vite --open --mode mock",
|
||||
"dev": "vite --open --mode development",
|
||||
|
@ -27,7 +27,7 @@
|
|||
"qrcode.vue": "^3.2.2",
|
||||
"qs": "^6.10.5",
|
||||
"tdesign-icons-vue-next": "^0.1.1",
|
||||
"tdesign-vue-next": "0.19.0",
|
||||
"tdesign-vue-next": "0.20.2",
|
||||
"tvision-color": "^1.3.1",
|
||||
"vue": "^3.2.31",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
|
|
|
@ -63,10 +63,11 @@ export default defineComponent({
|
|||
const appendNewRoute = () => {
|
||||
const {
|
||||
path,
|
||||
query,
|
||||
meta: { title },
|
||||
name,
|
||||
} = route;
|
||||
tabsRouterStore.appendTabRouterList({ path, title: title as string, name, isAlive: true });
|
||||
tabsRouterStore.appendTabRouterList({ path, query, title: title as string, name, isAlive: true });
|
||||
};
|
||||
|
||||
const getTabRouterListCache = () => {
|
||||
|
@ -105,17 +106,19 @@ export default defineComponent({
|
|||
|
||||
tabsRouterStore.subtractCurrentTabRouter({ path, routeIdx: index });
|
||||
if (path === route.path) {
|
||||
router.push(nextRouter.path);
|
||||
router.push({ path: nextRouter.path, query: nextRouter.query });
|
||||
}
|
||||
};
|
||||
const handleChangeCurrentTab = (path: string) => {
|
||||
router.push(path);
|
||||
const { tabRouters } = tabsRouterStore;
|
||||
const route = tabRouters.find((i) => i.path === path);
|
||||
router.push({ path, query: route.query });
|
||||
};
|
||||
const handleRefresh = (currentPath: string, routeIdx: number) => {
|
||||
tabsRouterStore.toggleTabRouterAlive(routeIdx);
|
||||
const handleRefresh = (route: TRouterInfo) => {
|
||||
tabsRouterStore.toggleTabRouterAlive(route.routeIdx);
|
||||
nextTick(() => {
|
||||
tabsRouterStore.toggleTabRouterAlive(routeIdx);
|
||||
router.replace({ path: currentPath });
|
||||
tabsRouterStore.toggleTabRouterAlive(route.routeIdx);
|
||||
router.replace({ path: route.path, query: route.query });
|
||||
});
|
||||
};
|
||||
const handleCloseAhead = (path: string, routeIdx: number) => {
|
||||
|
@ -195,7 +198,7 @@ export default defineComponent({
|
|||
dropdown: () =>
|
||||
router.path === route.path ? (
|
||||
<t-dropdown-menu>
|
||||
<t-dropdown-item onClick={() => handleRefresh(router.path, idx)}>
|
||||
<t-dropdown-item onClick={() => handleRefresh(router)}>
|
||||
<t-icon name="refresh" />
|
||||
刷新
|
||||
</t-dropdown-item>
|
||||
|
|
|
@ -18,8 +18,6 @@ router.beforeEach(async (to, from, next) => {
|
|||
const { token } = userStore;
|
||||
if (token) {
|
||||
if (to.path === '/login') {
|
||||
userStore.logout();
|
||||
permissionStore.restore();
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
@ -58,6 +56,10 @@ router.beforeEach(async (to, from, next) => {
|
|||
}
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
router.afterEach((to) => {
|
||||
if (to.path === '/login') {
|
||||
userStore.logout();
|
||||
permissionStore.restore();
|
||||
}
|
||||
NProgress.done();
|
||||
});
|
||||
|
|
3
src/types/interface.d.ts
vendored
3
src/types/interface.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import { RouteRecordName } from 'vue-router';
|
||||
import { RouteRecordName, LocationQueryRaw } from 'vue-router';
|
||||
import STYLE_CONFIG from '@/config/style';
|
||||
|
||||
export interface MenuRoute {
|
||||
|
@ -36,6 +36,7 @@ export interface NotificationItem {
|
|||
|
||||
export interface TRouterInfo {
|
||||
path: string;
|
||||
query?: LocationQueryRaw;
|
||||
routeIdx?: number;
|
||||
title?: string;
|
||||
name?: RouteRecordName;
|
||||
|
|
|
@ -84,7 +84,11 @@ const transform: AxiosTransform = {
|
|||
if (formatDate) {
|
||||
formatRequestDate(params);
|
||||
}
|
||||
if (Reflect.has(config, 'data') && config.data && Object.keys(config.data).length > 0) {
|
||||
if (
|
||||
Reflect.has(config, 'data') &&
|
||||
config.data &&
|
||||
(Object.keys(config.data).length > 0 || data instanceof FormData)
|
||||
) {
|
||||
config.data = data;
|
||||
config.params = params;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user