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()
}
},