• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Vue2 watch监听prophotoshop的值

武飞扬头像
iiiilooaixuud
帮助1

再次遇到监听子组件收到父组件传过来的值,如果这个值变化,页面中的值发现是不会跟着同步变化的。所以监听props中的值,一直监听。

学新通

学新通 

代码:

  1.  
    props: {
  2.  
    start:{
  3.  
    type: String,
  4.  
    },
  5.  
    end:{
  6.  
    type: String,
  7.  
    }
  8.  
    },
  1.  
    computed:{
  2.  
    myStart:function(){
  3.  
    return this.start
  4.  
    },
  5.  
    myEnd:function(){
  6.  
    return this.end
  7.  
    }
  8.  
    },
  9.  
    watch: {
  10.  
    myStart:function(newVal){
  11.  
    if(newVal){
  12.  
    this.startTime=newVal
  13.  
    }
  14.  
    },
  15.  
    myEnd:function(newVal){
  16.  
    if(newVal){
  17.  
    this.endTime=newVal
  18.  
    }
  19.  
    },
  20.  
    },
学新通

本篇文章来至:学新通

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通
  • 本文地址: https://www.swvq.com/boutique/detail/tanhcjcfjg
  • 联系方式: luke.wu#vfv.cc
系列文章
更多 icon
同类精品
更多 icon
我要评论
我的头像
精彩评论
继续加载