账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    子组件computed属性改变视图不改变
    27
    0

    父组件:

    <parent :date_schedule="date_schedule"></parent>

    子组件:

    props: {
        date_schedule:{
            type:Array,
            default: []
        },
      },
      data () {
        return {
          ...
        }
      },
      watch: {
        date_schedule: {
            handler(newVal,oldVal) {
                console.log(newVal)
                console.log(oldVal)
                //console.log('date_schedule:update');
                //this.update_calendar_schedule();
            },
            deep: true
        },
        table_data: {
            handler(value) {
                //console.log('table_data:update');
                //this.update_calendar_schedule();
            },
            deep: true
        },
      },
      computed: {
        table_data:{
            get: function() {
                return this.date_schedule;
            },
            set: function(value) {
                console.log(value);
            }
        },
      },
     
      

    子组件中使用table_data来渲染出一个table。
    当父组件的date_schedule修改时,子组件的date_schedule和table_data都有变化,
    但是子组件中的table视图却不随变化而更新,显示的永远是还是上一次table_data数据。
    我知道是数据检测变化的问题,但始终找不出是哪里的问题,请大家帮忙看一下~谢谢了

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 轻烟薄暮 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部