mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-30 10:54:06 +08:00
优化 vue2 的前端,登出系统时,拼接 BASE PATH
This commit is contained in:
@@ -197,3 +197,28 @@ export function getDocEnable() {
|
||||
}
|
||||
return process.env.VUE_APP_DOC_ENABLE || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 Vue 应用的基础路径
|
||||
*/
|
||||
export function getBasePath() {
|
||||
return process.env.VUE_APP_APP_NAME || '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得 Vue 应用的访问路径
|
||||
*
|
||||
* @param path 路径
|
||||
*/
|
||||
export function getPath(path) {
|
||||
// 基础路径,必须以 / 结尾
|
||||
let basePath = getBasePath();
|
||||
if (!basePath.endsWith('/')) {
|
||||
return basePath + '/';
|
||||
}
|
||||
// 访问路径,必须不能以 / 开头
|
||||
if (path.startsWith('/')) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
return basePath + path;
|
||||
}
|
||||
|
Reference in New Issue
Block a user