mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-21 16:30:34 +03:00
fix: Handle kept-alive components & vue-router transitions
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import Vue from 'vue'
|
||||
import VueMeta from 'vue-meta'
|
||||
|
||||
Vue.use(VueMeta)
|
||||
|
||||
Vue.component('foo', {
|
||||
template: '<p>Foo component</p>',
|
||||
metaInfo: {
|
||||
title: 'Keep me Foo'
|
||||
}
|
||||
})
|
||||
|
||||
new Vue({
|
||||
template: `
|
||||
<div id="app">
|
||||
<h1>Kept alive foo</h1>
|
||||
<button @click="show">Toggle Foo</button>
|
||||
<keep-alive>
|
||||
<foo v-if="showFoo"/>
|
||||
</keep-alive>
|
||||
</div>
|
||||
`,
|
||||
data () {
|
||||
return { showFoo: false }
|
||||
},
|
||||
methods: {
|
||||
show () {
|
||||
this.showFoo = !this.showFoo
|
||||
}
|
||||
},
|
||||
metaInfo: () => ({
|
||||
title: 'Keep-alive'
|
||||
})
|
||||
}).$mount('#app')
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<a href="/">← Examples index</a>
|
||||
<div id="app"></div>
|
||||
<script src="/__build__/keep-alive.js"></script>
|
||||
Reference in New Issue
Block a user