Vue同时监听多个数据

1、
computed: {
    dateRange () {
      const { checkindex, docName } = this
      return {
        checkindex,
        docName
      }
    }
  },

2、
watch: {
    dateRange (newval,oldval){
      console.log(newval,'哈哈哈')
       if(newval.checkindex==0){
          document.title='医生主页'
        }else if(newval.checkindex==1){
          // console.log(this.docName,'---')
          document.title='与'+this.docName+'医生的对话'
        }else if(newval.checkindex==2){
          document.title='我的病历'
        }
    },
  },
原文地址:https://www.cnblogs.com/fkcqwq/p/13207933.html