![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
我是红花啊
这个作者很懒,什么都没留下…
展开
-
前端json对象的key排序
将json的key按照a-z排序,此函数可深层次排序Vue.prototype.jsonSort = function (data) { // 对象的key排序 var newkey = Object.keys(data).sort(); var newObj = {}; for(var i = 0; i < newkey.length; i++) { newObj[newkey[i]] = data[newkey[i]]; if(typeof data[原创 2020-11-01 18:47:24 · 712 阅读 · 0 评论 -
JSON对象去除字段中的空字符串,null,undefined
// 去除空字符串,null,undefinedVue.prototype.removeEmptyField = function (obj) { var newObj = {}; if (typeof obj == "string") { obj = JSON.parse(obj); } if (obj instanceof Array) { newObj = []; } if (obj instanceof Object) { for (var attr原创 2020-11-01 18:37:11 · 2049 阅读 · 0 评论 -
前端vue项目js数据加密MD5、DES
建一个js文件,存放加/解密函数import Vue from 'vue'import CryptoJS from "crypto-js";一、MD5全局加密函数Vue.prototype.EncryptMD5 = function (data) { if (typeof data === 'string') { data = data } else { data = JSON.stringify(data) } const encrypted = CryptoJS原创 2020-11-01 18:22:47 · 326 阅读 · 1 评论