Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Obtener datos de Django a la plantilla Vue

Estoy tratando de obtener datos de Django a las variables de Vuetemplate.

vistas.py

 def index(request): myvar = 1 return render(request, 'index.html',{'myvar':myvar})

en index.html

 <span> {{ myvar }} </span>

Está funcionando y muestra 1, pero ¿cómo puedo obtener este 1/myvar en datos dentro de la instancia de vue?

 var app = new Vue({ el: "#app", data: { // here i need the data/value of myvar }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede obtener el valor a través de parámetros de ruta

 var app = new Vue({ el: "#app", data: { // here i need the data/value of myvar myvar: this.$route.params.myvar }
about 4 years ago · Juan Pablo Isaza Report

0

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

A mí me funciona, this.$route.params.myvar no hace que no esté usando vuerouter.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!