Ali Kleit
Ali Kleit

Reputation: 3649

Can you use nuxt in browser version vuejs?

Can you use nuxt for vuejs cdn and are there any alternatives for SEO if not?

I'm using .net webforms and vue js to fetch the data, When i view-source the site, i can still see the mustache template

I'm new to implementing SEO using vuejs without having webpack, the only alternative i can think about is preloading the content server-side so by that the vue app will be useless.

A snippet of the app:

var my_app = new Vue({
  el: '#MyApp',
  data: {
     subjects: [],
     isLoading:true
  },

  mounted: function(){
     // fetch and fill data
  } 
})

And Form.aspx contains:

<div id="MyApp">
   <p v-show="isLoading">Please Wait...</p>
   <p v-for="item in subjects">{{item.name}}</p>
</div>

Any help or suggestion would be appreciated, Thanks!

Upvotes: 0

Views: 340

Answers (1)

s4k1b
s4k1b

Reputation: 3085

Nuxt is used primarily for server side rendering your html. It runs on a backend nodejs server. There is no browser version of nuxt js that can be loaded via cdn.

If you want to fetch your data in client side (i.e: in your browser), then load vue.js via cdn. eg: <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>. Note that this will not be server side rendered and will not be Search Engine Optimized.

It you want SEO, you will have to run nuxt server in your backend and use fetch your data inside the fetch hook. Read more about using Nuxt and it's hooks from the official docs here

Upvotes: 2

Related Questions