美文网首页
vue watch 的使用

vue watch 的使用

作者: 飞鱼_JS | 来源:发表于2017-08-26 23:47 被阅读0次
  watch:{
   'searchDatas.City':{
      handler(curVal,oldVal){
//    console.log(curVal,oldVal)
    
    // 城市统计------------------------
        this.axios({
          method:"get",
          url:this.siteUrl+"/place/GetHotCitys?city="+this.searchDatas.City ,
        })
        .then((res)=>{
          console.log("type", typeof res.data)
          // if(typeof res.data == String){
             // console.log("res",res.data)
            if(res.data!="" ){
              res.data=JSON.parse(res.data)
            }     
          // }
          // console.log("res2",res.data)
          this.citys=res.data
        })
        .catch((err)=>{
          console.log(err)
        })
     },
   deep:true
    }
  }

相关文章

网友评论

      本文标题:vue watch 的使用

      本文链接:https://www.haomeiwen.com/subject/sgavdxtx.html