标签:turn data 两种方法 ring sig util tab pcl string
deepClone: obj => {
var _obj
if (typeof obj === ‘object‘ && obj !== null) {
if (Object.prototype.toString.call(obj) === ‘[object Object]‘) {
_obj = {}
for (var key in obj) {
_obj[key] = utils.deepClone(obj[key])
}
return _obj
} else if (Object.prototype.toString.call(obj) === ‘[object Array]‘) {
_obj = []
for (var _key in obj) {
_obj[_key] = utils.deepClone(obj[_key])
}
return _obj
}
} else {
return obj
}
},
数据
JSON.parse(JSON.stringify())
数组
map(_=>_)
filter
find
Array.from()
Array.prototype.forEach
对象
Object.assign({}, this.$route.query, { tabName: data.name })
.除了上面两种方法之外,我们还可以借用JQ的extend方法。
$.extend( [deep ], target, object1 [, objectN ] )
deepClone
标签:turn data 两种方法 ring sig util tab pcl string
原文地址:https://www.cnblogs.com/gudun/p/9522141.html