1
This commit is contained in:
25
utils/tool.ts
Normal file
25
utils/tool.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export function escapeHtml(str: string) {
|
||||
let temp = '';
|
||||
if (str.length === 0) return '';
|
||||
temp = str.replace(/&/g, '&');
|
||||
temp = temp.replace(/</g, '<');
|
||||
temp = temp.replace(/>/g, '>');
|
||||
temp = temp.replace(/ /g, ' ');
|
||||
temp = temp.replace(/'/g, "'");
|
||||
temp = temp.replace(/"/g, '"');
|
||||
return temp;
|
||||
}
|
||||
|
||||
export function isArray(str: unknown) {
|
||||
return Object.prototype.toString.call(str) === '[object Array]';
|
||||
}
|
||||
|
||||
// 配置服务器接口
|
||||
export function getBaseUrl() {
|
||||
console.log('process:',process.server)
|
||||
if (process.server) {
|
||||
return "https://modules.gxwebsoft.com/api"
|
||||
} else {
|
||||
return "https://modules.gxwebsoft.com/api"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user