Former-commit-id: 38761ffec2445c35ba6a6a1bbe42a978bc008d5c
master
王兵 4 years ago
parent 716af50cb4
commit ab34aca2c9

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -199,6 +199,15 @@ window.utils = {
base64toString: function (base64) {
return window.atob(base64);
},
/**
* String转为base64
*
* @param base64 base64字符串
* @returns {string} 字符串
*/
stringtoBase64: function (str) {
return window.btoa(str);
},
/**
* base64转为字节数组
*
@ -225,17 +234,21 @@ window.utils = {
isEmpty: function(val){
return val === '' || typeof val === 'undefined' || val === null;
},
/**
* 动态加载Js或css文件
* @param url 文件http地址
*/
loadJsCss: function(url){
var node_;
if (url.match(/\\.js$/i)) {
node_ = document.createElement('script');
node_.setAttribute("type", "text/javascript");
node_.setAttribute("src", fileurl);
node_.setAttribute("src", url);
} else if (url.match(/\\.css$/i)) {
node_ = document.createElement('link');
node_.setAttribute("rel", "stylesheet");
node_.setAttribute("type", "text/css");
node_.setAttribute("href", fileurl);
node_.setAttribute("href", url);
}
if (node_) {
document.getElementsByTagName("head")[0].appendChild(node_);
@ -243,6 +256,10 @@ window.utils = {
console.error("load " + url + " method error!");
}
},
/**
* 深拷贝对象
* @param obj
*/
copy: function(obj){
return JSON.parse(JSON.stringify(obj));
}

Loading…
Cancel
Save

Powered by TurnKey Linux.