<template> <div id="app"> <keep-alive> <router-view v-if="$route.meta.keepAlive" :key="key"/> </keep-alive> <router-view v-if="!$route.meta.keepAlive" :key="key"/> </div> </template> <script> export default { name: 'App', computed: { key() { if (this.$route.meta.keepAlive) { return this.$route.name !== undefined ? this.$route.name : this.$route } else { return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() } } } } </script> <style lang="stylus" rel="stylesheet/stylus"> @import "~assets/css/variable.styl" html, body { overflow hidden overflow-y auto width 100% height 100% padding 0 margin 0 } </style>