jeudi 28 mars 2019

How to pass JS variable into Vue instance

In my Laravel blade template I have a javascript snippet that produces a variable that holds an index (named nextIndex), for an array. I would like to use that index in a Vue instance, like this:

var app = new Vue({
    el: '#root',
    data: {
        url: "/"
    }
});

I have spent hours searching the internet and reading the documentation, but maybe I am looking at the wrong places. How can I pass the JS variable nextIndex into the vue data above?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire