vue elementui 页面监控form表单数据变化

时间:2020-04-13 15:10:33   收藏:0   阅读:742
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()
        }
      },

  

原文:https://www.cnblogs.com/xzybk/p/12691105.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!