xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

vue & modal props & form data update bug

vue & modal props & form data update bug

OK

  <div>
    <BindModal
      :dialogBindVisible="dialogBindVisible"
      :dialogBindData="dialogBindData"
      @close-bind-item="closeBindItem"
      @save-bind-item="saveBindItem"
    />
    <EditModal
      :dialogEditVisible="dialogEditVisible"
      :dialogEditData="dialogEditData"
      @close-edit-item="closeEditItem"
      @save-edit-item="saveEditItem"
    />
  </div>

    watch: {
      dialogBindVisible(newProp, oldProp){
        if(newProp !== oldProp) {
          this.activityId = "";
          log(`newProp, oldProp`, newProp, oldProp);
        }
        this.visible = newProp;
      },
      dialogBindData(newProp, oldProp){
        this.form = {
          ...this.form,
          ...newProp,
        };
      },
    },

posted @ 2020-01-14 17:14  xgqfrms  阅读(279)  评论(1编辑  收藏  举报