提交 7713b034 编写于 作者: G Guillaume Chau

perf(router): use keep-alive

上级 cc2612a2
...@@ -158,7 +158,9 @@ ...@@ -158,7 +158,9 @@
</div> </div>
</div> </div>
<router-view class="container" /> <keep-alive>
<router-view class="container" />
</keep-alive>
</div> </div>
</template> </template>
......
...@@ -12,12 +12,20 @@ export default function ({ ...@@ -12,12 +12,20 @@ export default function ({
}, },
mounted () { mounted () {
requestAnimationFrame(() => { this.refreshScrollToInspected()
if (this.inspectedIndex) this.scrollIntoInspected(this.inspectedIndex) },
})
activated () {
this.refreshScrollToInspected()
}, },
methods: { methods: {
refreshScrollToInspected () {
requestAnimationFrame(() => {
if (this.inspectedIndex) this.scrollIntoInspected(this.inspectedIndex)
})
},
scrollIntoInspected: debounce(function (index) { scrollIntoInspected: debounce(function (index) {
index += indexOffset index += indexOffset
this.$nextTick(() => { this.$nextTick(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册