mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-14 06:22:10 +08:00
Pre Merge pull request !136 from guo_ddt/master-fetch
This commit is contained in:
commit
385497dfe3
@ -13,6 +13,11 @@ const routerAllowList = [
|
||||
export function createRouterGuards(router: Router) {
|
||||
// 前置
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
// http://localhost:3000/#/chart/preview/792622755697790976?t=123
|
||||
// 把外部动态参数放入sessionStorage,后续API动态接口可以用sessionStorage拼接参数
|
||||
for (let queryKey in to.query) {
|
||||
window.sessionStorage.setItem(queryKey,<string>to.query[queryKey])
|
||||
}
|
||||
const Loading = window['$loading'];
|
||||
Loading && Loading.start();
|
||||
const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name);
|
||||
|
@ -169,7 +169,8 @@ export const fetchRouteParams = () => {
|
||||
*/
|
||||
export const fetchRouteParamsLocation = () => {
|
||||
try {
|
||||
return document.location.hash.split('/').pop() || ''
|
||||
// 防止添加query参数的时候,解析ID异常
|
||||
return document.location.hash.split('?')[0].split('/').pop() || ''
|
||||
} catch (error) {
|
||||
window['$message'].warning('查询路由信息失败,请联系管理员!')
|
||||
return ''
|
||||
@ -203,7 +204,7 @@ export const loginCheck = () => {
|
||||
|
||||
/**
|
||||
* * 预览地址
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export const previewPath = (id?: string | number) => {
|
||||
const { origin, pathname } = document.location
|
||||
|
Loading…
x
Reference in New Issue
Block a user