在vue使用console.log()打印變量 會有多餘咱們不指望看到的屬性
並且展開方式不友好vue
因此咱們來重置一個打印方式:this
在main.js文件中添加一下代碼spa
Vue.prototype.print = (obj,type) => { type = type || "log"; const log = JSON.parse(JSON.stringify(obj)); console[type](log) }
之後咱們打印變量就能夠直接使用prototype
this.print(obj) //或者 this.print(obj,"error")
這樣打印出來的信息就是以咱們熟悉的方式打印了code