代码: Vue.mixin({ beforeRouteLeave: function(to, from, next) { // console.log(this.$route) if (this.$vnode && this.$vnode.data.keepAlive) { if (this.$vnode.