您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

vue父子组件传值子组件没及时更新

vue父子组件传值子组件没及时更新

image.png
image.png
image.png
页面上两个input框,点击弹出弹框,使用了子组件,客户弹框里面的table没有选择框,关联订单弹框表格带选择框,在分别打开弹框时向子组件传递了helpStatus,值分别对应了名字

点击客户input框时,传递helpStatus
image.png
点击关联订单input框时,传递helpStatus
image.png
子组件页面的两个 table使用了v-if 和v-else

   <el-table
        v-if="status !== '关联订单'"
        :data="helpData"
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        :height="tableHeight"
        style="max-height: 528px;"
        v-loading="helpDataStatus"
        highlight-current-row
        @row-click="handleCurrentHelpTable"
        :row-class-name="tableRowClassName"
        row-key="id"
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      >
        <el-table-column
          v-if="helpStatus != '规格模板'"
          :prop="helpCode"
          label="编码"
        ></el-table-column>

        <el-table-column :prop="helpName" label="名称"></el-table-column>
        <el-table-column
          v-if="helpStatus == '规格模板'"
          :prop="helpAttri"
          label="商品属性"
        ></el-table-column>
      </el-table>
      <el-table
        v-else
        :data="helpData"
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        :height="tableHeight"
        style="max-height: 528px;"
        v-loading="helpDataStatus"
        highlight-current-row
        @row-click="handleCurrentHelpTable"
        :row-class-name="tableRowClassName"
        @selection-change="handleSelectionChange"
        row-key="id"
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column
          v-if="helpStatus != '规格模板'"
          :prop="helpCode"
          label="编码"
        ></el-table-column>

        <el-table-column :prop="helpName" label="名称"></el-table-column>
        <el-table-column
          v-if="helpStatus == '规格模板'"
          :prop="helpAttri"
          label="商品属性"
        ></el-table-column>
      </el-table>

添加了watch监听,并且可以打印出数据,但是先打开客户弹框再打开关联订单弹框表格就不显示前面的选择框了,两个弹框在切换时并没有改变,求如何修改,感谢各位
image.png

image.png

javascript 2022/2/18 19:32:26 有607人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶