首页 > 解决方案 > vue dom 不会重新渲染

问题描述

我使用 v-for 来呈现表格行

<table>
  <tr v-for="(item, i) in data">
    <td>
      <button v-if="...">....</button>
      <el-tooltipplacement="right">
        <button v-if="..." >...</button>
        <div slot="content">
          <button @click="...">...</button>
          <button @click="...">...</button>
        </div>
      </el-tooltip>
    </td>
  </tr>
</table>

tooltip 是 element ui 的一个组件,tooltip 会在按钮悬停后显示。表格数据是通过ajax调用获取的,有好几页,翻页时会通过ajax调用获取数据,翻页后出现问题。悬停后某些工具提示不会显示,我认为问题是 dom 没有重新渲染,我在 ajax 调用后使用了 $forceUpdate() ,但它没有效果。如果可以请帮帮我。

element ui Tooltip 组件及示例:https://element.eleme.io/#/en-US/component/tooltip

标签: vue.jsv-forrerender

解决方案


推荐阅读