Hi,
Following your example on https://nuxtjs.org/api/configuration-generate#routes I am able to generate static html-files with dynamic routes. I.E. like so
<template>
<article class="content">
<vue-markdown>{{blogPost.content}}</vue-markdown>
</article>
</template>
<script>
export default {
async asyncData ({ payload }) {
if (payload) {
return { blogPost: payload }
}
}
}
</script>into so
<!DOCTYPE html>
<html data-n-head="lang" data-n-head-ssr lang="en">
<head>
...
<body data-n-head="">
<section class="hero" id="banner">
<div class="container">
<article class="content">
<div><strong>bold</strong></div>
</article>
</div>
</section>
<script type="text/javascript">window.__NUXT__ = {
layout: 'default',
data: [ {
blogPost: {
id: '98219',
updatedAt: '2017-09-14T10:43:39.443Z',
isValid: !0,
content: '**bold**',
tags: 'test,nuxt,dato',
meta: {
image: {
alt: null,
path: '/3263/1505385491-stock-photo-example-stamp-123670585.jpg',
size: 38787,
title: null,
width: 450,
format: 'jpg',
height: 315
}, title: 'Test Blog Post #1', description: 'This blog post sole purpose is to test dato along with nuxt.'
},
slug: 'test-blog-post-1',
title: 'Test Blog Post #1',
itemType: '14525',
lastEditor: '2422'
}
} ],
error: null,
state: {},
serverRendered: !0
}</script>
...As you can see I omitted the
else return { user: await backend.fetchUser(params.id) }part of the toturial as I don't wish for the data to be fetched again on page load. But the component still tries to re-render, and cannot read property 'content' of undefined pops up on page load.
Is there a way to make the page not re-render on page load, or for the component to use the data on window.__nuxt__.data?
I tried to be as specific as possible, but please ask if anything is unclear!
Oh, and thanks for the help in advance :)
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1485">#c1485</a>)</em></sub></div>