computed: {
watchList: function() {
const obj = {}
Object.keys(this.good).forEach(key => {
obj[key] = this.good[key]
})
return obj
}
},
watch: {
watchList: {
deep: true,
handler: function(newVal,oldVal) {
if (newVal !== oldVal) {
window.valueChange = true
}
}
},
'$route': function() {
// 這里要加一個提示窗 提示沒有保存是否切換到其它頁面
this.$refs['good'].clearValidate()
this.$refs['good'].resetFields()
}
},
// 返回
goBack() {
if(this.good.name||this.good.remark){
if (this.$route.query.type == 1) {
this.text = '確定放棄編輯黑名單組嗎?'
} else {
this.text = '確定放棄新增黑名單組嗎?'
}
alert.goBack(this.text)
}else{
window.valueChange = false
alert.goBack()
}
},
