1、main.js挂载原型方法
Vue.prototype.clone = function clone(obj) {
if (!obj) {
return obj
}
return JSON.parse(JSON.stringify(obj))
}
2、使用
const obj = {Obj: 'tac'}
const objClone = this.clone(obj)
1、main.js挂载原型方法
Vue.prototype.clone = function clone(obj) {
if (!obj) {
return obj
}
return JSON.parse(JSON.stringify(obj))
}
2、使用
const obj = {Obj: 'tac'}
const objClone = this.clone(obj)