[Vuejs]-Vue Router with Render Template

0👍

Your Home.js should look something like this.

const Home = Vue.component('home', function(resolve) {
    $.get('templates/home.html').done(function(template) {
        resolve({
            template: template,
            data: function () {
                return {
                    message: 'Welcome'
                }
            }
        })
    })
})


export default {
    Home: Home
}

Import it into your Route.js.

const Home = require('./Home.js').Home

Leave a comment