vuejs / vue2-ssr-docs

Vue.js Server-Side Rendering Guide (for Vue 2)
564 stars 239 forks source link

Documentation for client data fetching before route navigation #229

Open ozguruysal opened 5 years ago

ozguruysal commented 5 years ago

New serverPrefetch is great to prefetch data on server side but the new documentation doesn't include an example for prefetching data on the client.

thearabbit commented 5 years ago

I try like this, but don't show any log

<template>
  <div>
    <h1>Home</h1>
  </div>
</template>

<script>
export default {
  name: "Home",
  serverPrefetch() {
    console.log("serverPrefetch");
  },
  mounted() {
    console.log("mounted");
  }
};
</script>