原因:因为父组件有缓存等因素,子组件创建后没有释放,传入参数无效,使用v-if的特性(销毁和重建)可以强制刷新子组件

    <el-drawer
      ref="detailTable"
      :title="detailTitle"
      :append-to-body="true"
      :visible.sync="dialogDetailFormVisible"
      direction="ltr"
      :wrapper-closable="false"
      size="90%"
    >
      <div class="el-drawer__body">
        <el-row :gutter="10">
          <el-col :span="22" :offset="1">
            <ProjectMileStone v-if="forceRefresh" :project-id="projectId" />
          </el-col>
        </el-row>
      </div>
    </el-drawer>
toView(row) {
      this.forceRefresh = false
      this.projectId = row.projectId
      this.detailTitle = row.projectName
      // 强制刷新子组件
      this.$nextTick(() => {
        this.forceRefresh = true
        this.dialogDetailFormVisible = true
      })
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2021-09-01
  • 2022-12-23
  • 2021-06-13
  • 2021-09-09
  • 2021-08-21
猜你喜欢
  • 2021-06-22
  • 2022-01-29
  • 2021-07-15
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案