I was wondering whether the following behavior of nuxt generate
is wrong or am I only misunderstanding the basics of the concept of static content generation.
I downloaded the starter-template and put a very basic reactive element into pages/index.vue
, e.g. an input element with a v-model
that points to an ordinary data attribute:
<template>
<input v-model="val">
{{ val }}
</template>
<script>
export default {
data () {
return {
val: 'something'
}
}
}
</script>
When I run npm run dev
, I get the expected behavior, that is, the string below the input updates immediately when I update the value of the input. But when I run npm run generate
, that does not happen. Instead, the string below the input stays "something" after I update the input. That implies that the Vue instance is not being mounted on the statically generated html. What is then the point of having all those javascript files loaded with the page? I don't know a thing about Vue SSR, but I can't see a limitation that would prevent this -- however, nor do I know how to actually do it, having zero experience with SSR.
As I understand, there is also a SPA deployment mode, which is similar to generate, but strips the pages of the content (calls to some api are then supposed to provide it). I haven't been able to try that out much, but it seems to me that it's not much different than prerendering as far as mounting the Vue instance on generated html goes -- correct me if I am wrong.
Otherwise, hats off to the nuxt developers and community. It's a real pleasure developing with nuxt.
<!--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/c1497">#c1497</a>)</em></sub></div>