mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增预览页
This commit is contained in:
+14
-6
@@ -37,10 +37,14 @@ export const routerTurnByName = (
|
||||
* @param pageName
|
||||
*/
|
||||
export const fetchPathByName = (pageName: string, p?: string) => {
|
||||
const pathData = router.resolve({
|
||||
name: pageName,
|
||||
})
|
||||
return p ? (pathData as any)[p] : pathData
|
||||
try {
|
||||
const pathData = router.resolve({
|
||||
name: pageName,
|
||||
})
|
||||
return p ? (pathData as any)[p] : pathData
|
||||
} catch (error) {
|
||||
window['$message'].warning('查询路由信息失败,请联系管理员!')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,8 +134,12 @@ export const openGiteeSourceCode = () => {
|
||||
* @returns object
|
||||
*/
|
||||
export const fetchRouteParams = () => {
|
||||
const route = useRoute()
|
||||
return route.params
|
||||
try {
|
||||
const route = useRoute()
|
||||
return route.params
|
||||
} catch (error) {
|
||||
window['$message'].warning('查询路由信息失败,请联系管理员!')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* * 存储本地会话数据
|
||||
* @param k 键名
|
||||
* @param v 键值
|
||||
* @param v 键值(无需stringiiy)
|
||||
* @returns RemovableRef
|
||||
*/
|
||||
export const setLocalStorage = <T>(k: string, v: T) => {
|
||||
@@ -15,9 +15,10 @@
|
||||
|
||||
/**
|
||||
* * 获取本地会话数据
|
||||
* @param k 键名
|
||||
* @returns any
|
||||
*/
|
||||
export const getLocalStorage: (k: string) => any = (k: string) => {
|
||||
export const getLocalStorage = (k: string) => {
|
||||
const item = window.localStorage.getItem(k)
|
||||
try {
|
||||
return item ? JSON.parse(item) : item
|
||||
|
||||
Reference in New Issue
Block a user