[Vuejs]-Get data from Django to Vue Template

0👍

You can grab the value via params of route

var app = new Vue({
  el: "#app",
  data: { 
// here i need the data/value of myvar
   myvar: this.$route.params.myvar
}

0👍

var app = new Vue({
  el: "#app",
  data: { 
    myvar: '{{ myvar }}' //myvar comes from django urls.py
}

Works for me, this.$route.params.myvar doesn’t cause im not using vuerouter.

Leave a comment