Files
x_admin/x_admin_app/methods/index.ts
2024-06-07 15:45:15 +08:00

28 lines
669 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { perms } from "@/utils/perms";
import { toPath } from "@/utils/utils";
import env from "@/utils/env";
/**
* @description: 获取文件路径
* @param {String} src 文件路径
* @return {String} 文件路径
*/
export function filePath(src :string) {
let path = "";
if (src) {
if (src.startsWith("http")) {
return src;
}
path = `${env.baseUrl}${src}`;
}
return path;
}
// 在全局配置对象中添加$perms属性并将其值设为perms
export function installMethods(app) {
app.config.globalProperties.$perms = perms;
app.config.globalProperties.$toPath = toPath;
app.config.globalProperties.$filePath = filePath;
}