Skip to content

Instantly share code, notes, and snippets.

@trandaison
Created April 28, 2023 02:55
Show Gist options
  • Save trandaison/1c413587b0a52a582fd2def409a2d6e8 to your computer and use it in GitHub Desktop.
Save trandaison/1c413587b0a52a582fd2def409a2d6e8 to your computer and use it in GitHub Desktop.
Re-create page component when click on same page router link in Vue/Nuxt
<template>
<div class="container">
<div class="content-page">
<Nuxt :key="`${routerViewKey}:${$route.fullPath}`" />
</div>
<footer class="text-center">
<span>© {{ new Date().getFullYear() }}</span>
</footer>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import { mapState } from 'vuex';
export default Vue.extend({
name: 'DefaultLayout',
computed: {
...mapState('appLink', ['routerViewKey']),
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment