Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
0aeec5e9
提交
0aeec5e9
authored
1月 15, 2021
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mitt): logout and clear the mitt
上级
b9d53a71
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
28 行增加
和
17 行删除
+28
-17
package.json
package.json
+2
-2
useDataSource.ts
src/components/Table/src/hooks/useDataSource.ts
+8
-6
tabChange.ts
src/logics/mitt/tabChange.ts
+4
-0
permissionGuard.ts
src/router/guard/permissionGuard.ts
+0
-9
stateGuard.ts
src/router/guard/stateGuard.ts
+14
-0
没有找到文件。
package.json
浏览文件 @
0aeec5e9
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
"devDependencies"
:
{
"devDependencies"
:
{
"
@commitlint/cli
"
:
"^11.0.0"
,
"
@commitlint/cli
"
:
"^11.0.0"
,
"
@commitlint/config-conventional
"
:
"^11.0.0"
,
"
@commitlint/config-conventional
"
:
"^11.0.0"
,
"
@iconify/json
"
:
"^1.1.28
5
"
,
"
@iconify/json
"
:
"^1.1.28
6
"
,
"
@ls-lint/ls-lint
"
:
"^1.9.2"
,
"
@ls-lint/ls-lint
"
:
"^1.9.2"
,
"
@purge-icons/generated
"
:
"^0.5.1"
,
"
@purge-icons/generated
"
:
"^0.5.1"
,
"
@types/echarts
"
:
"^4.9.3"
,
"
@types/echarts
"
:
"^4.9.3"
,
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
"
@types/zxcvbn
"
:
"^4.4.0"
,
"
@types/zxcvbn
"
:
"^4.4.0"
,
"
@typescript-eslint/eslint-plugin
"
:
"^4.13.0"
,
"
@typescript-eslint/eslint-plugin
"
:
"^4.13.0"
,
"
@typescript-eslint/parser
"
:
"^4.13.0"
,
"
@typescript-eslint/parser
"
:
"^4.13.0"
,
"
@vitejs/plugin-legacy
"
:
"^1.2.
0
"
,
"
@vitejs/plugin-legacy
"
:
"^1.2.
1
"
,
"
@vitejs/plugin-vue
"
:
"^1.0.5"
,
"
@vitejs/plugin-vue
"
:
"^1.0.5"
,
"
@vitejs/plugin-vue-jsx
"
:
"^1.0.2"
,
"
@vitejs/plugin-vue-jsx
"
:
"^1.0.2"
,
"
@vue/compiler-sfc
"
:
"^3.0.5"
,
"
@vue/compiler-sfc
"
:
"^3.0.5"
,
...
...
src/components/Table/src/hooks/useDataSource.ts
浏览文件 @
0aeec5e9
...
@@ -181,12 +181,14 @@ export function useDataSource(
...
@@ -181,12 +181,14 @@ export function useDataSource(
const
resultTotal
:
number
=
isArrayResult
?
0
:
get
(
res
,
totalField
);
const
resultTotal
:
number
=
isArrayResult
?
0
:
get
(
res
,
totalField
);
// 假如数据变少,导致总页数变少并小于当前选中页码,通过getPaginationRef获取到的页码是不正确的,需获取正确的页码再次执行
// 假如数据变少,导致总页数变少并小于当前选中页码,通过getPaginationRef获取到的页码是不正确的,需获取正确的页码再次执行
const
currentTotalPage
=
Math
.
ceil
(
resultTotal
/
pageSize
);
if
(
resultTotal
)
{
if
(
current
>
currentTotalPage
)
{
const
currentTotalPage
=
Math
.
ceil
(
resultTotal
/
pageSize
);
setPagination
({
if
(
current
>
currentTotalPage
)
{
current
:
currentTotalPage
,
setPagination
({
});
current
:
currentTotalPage
,
fetch
(
opt
);
});
fetch
(
opt
);
}
}
}
if
(
afterFetch
&&
isFunction
(
afterFetch
))
{
if
(
afterFetch
&&
isFunction
(
afterFetch
))
{
...
...
src/logics/mitt/tabChange.ts
浏览文件 @
0aeec5e9
...
@@ -25,3 +25,7 @@ export function listenerLastChangeTab(
...
@@ -25,3 +25,7 @@ export function listenerLastChangeTab(
mitt
.
on
(
key
,
callback
);
mitt
.
on
(
key
,
callback
);
immediate
&&
callback
(
lastChangeTab
);
immediate
&&
callback
(
lastChangeTab
);
}
}
export
function
removeTabChangeListener
()
{
mitt
.
clear
();
}
src/router/guard/permissionGuard.ts
浏览文件 @
0aeec5e9
import
type
{
Router
,
RouteRecordRaw
}
from
'vue-router'
;
import
type
{
Router
,
RouteRecordRaw
}
from
'vue-router'
;
import
{
appStore
}
from
'/@/store/modules/app'
;
import
{
permissionStore
}
from
'/@/store/modules/permission'
;
import
{
permissionStore
}
from
'/@/store/modules/permission'
;
import
{
PageEnum
}
from
'/@/enums/pageEnum'
;
import
{
PageEnum
}
from
'/@/enums/pageEnum'
;
import
{
getToken
}
from
'/@/utils/auth'
;
import
{
getToken
}
from
'/@/utils/auth'
;
import
{
PAGE_NOT_FOUND_ROUTE
}
from
'/@/router/constant'
;
import
{
PAGE_NOT_FOUND_ROUTE
}
from
'/@/router/constant'
;
// import { RootRoute } from '../routes/index';
const
LOGIN_PATH
=
PageEnum
.
BASE_LOGIN
;
const
LOGIN_PATH
=
PageEnum
.
BASE_LOGIN
;
...
@@ -69,11 +67,4 @@ export function createPermissionGuard(router: Router) {
...
@@ -69,11 +67,4 @@ export function createPermissionGuard(router: Router) {
permissionStore
.
commitDynamicAddedRouteState
(
true
);
permissionStore
.
commitDynamicAddedRouteState
(
true
);
next
(
nextData
);
next
(
nextData
);
});
});
router
.
afterEach
((
to
)
=>
{
// Just enter the login page and clear the authentication information
if
(
to
.
path
===
LOGIN_PATH
)
{
appStore
.
resumeAllState
();
}
});
}
}
src/router/guard/stateGuard.ts
0 → 100644
浏览文件 @
0aeec5e9
import
type
{
Router
}
from
'vue-router'
;
import
{
appStore
}
from
'/@/store/modules/app'
;
import
{
PageEnum
}
from
'/@/enums/pageEnum'
;
import
{
removeTabChangeListener
}
from
'/@/logics/mitt/tabChange'
;
export
function
createHttpGuard
(
router
:
Router
)
{
router
.
afterEach
((
to
)
=>
{
// Just enter the login page and clear the authentication information
if
(
to
.
path
===
PageEnum
.
BASE_LOGIN
)
{
appStore
.
resumeAllState
();
removeTabChangeListener
();
}
});
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论