Skip to content

Instantly share code, notes, and snippets.

@mjoey
Created May 11, 2021 13:02
Show Gist options
  • Select an option

  • Save mjoey/7cd4abff15339249295c6e40d3721887 to your computer and use it in GitHub Desktop.

Select an option

Save mjoey/7cd4abff15339249295c6e40d3721887 to your computer and use it in GitHub Desktop.
<template>
<div>
<h1>Hello Nuxters! 👋</h1>
<p>
This page is rendered on the <strong>{{ rendering }}</strong>
</p>
<p v-if="rendering === 'server'">
First load or hard refresh is done on server side.
</p>
<p v-if="rendering === 'client'">Navigation is done on client side.</p>
<ul>
<li>Refresh the page for server side rendering.</li>
<li>Click the links to see client side rendering.</li>
</ul>
<NuxtLink to="/about">About Page</NuxtLink>
</div>
</template>
<script>
export default {
asyncData() {
return {
rendering: process.server ? 'server' : 'client'
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment