Vue2:内存泄漏

时间:2017-05-02 13:08:18

标签: javascript vuejs2 vue-router vuex

我在生成组件和观察者时遇到问题,但在通过vue-router导航到新路线时没有被正确销毁。不应该自动处理吗?或者,有没有办法减少观察者的数量,使其更高效?

代码示例 (为什么节点和观察者数量如此之高)

<tbody>
  <tr v-for="record in data"
    @click.capture="rowClick(record)"
    @dblclick="rowDblClick(record)"
    :class="{ 'is-highlighted': isSelected(record) }">
    <td v-if="actionsVisible">
      <el-button-group>
        <el-button @click.stop="assign(record)" size="mini"><i class="fa fa-map-o"></i> </el-button>
        <el-button @click.stop="$emit('getActions', record)" size="mini" icon="more"></el-button>
      </el-button-group>
    </td>
    <td v-for="column in columns" :width="column.Width" :class="applyColors(record, column)">
      {{ formatData(record, column) }}
    </td>
  </tr>
</tbody>

环境

  • vue 2.3.0
  • vue-router 2.1.1
  • vuex 2.0.0

0 个答案:

没有答案