zoukankan      html  css  js  c++  java
  • vue 强制刷新子组件

    原因:因为父组件有缓存等因素,子组件创建后没有释放,传入参数无效,使用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
          })
        }
  • 相关阅读:
    Hadoop 集群搭建步骤
    Linux 常见的命令
    Mysql 的事物理解
    数据库的理论知识
    IDEA debug
    junit 测试
    Mysql 索引的知识
    JSON解析
    java 多线程
    Java集合框架关系图
  • 原文地址:https://www.cnblogs.com/asker009/p/13162391.html
Copyright © 2011-2022 走看看