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

204
Views
How to setup Vue.js SPA when starting it in HTML

I have a django application where I have an area that is made in Vue.js. I would like to know if it is possible to set parameters at the time of initialization of the Vue.js app in HTML. For example a token where the VueApp can use to authenticate and fetch some apis in django.

Today it is being done like this:

      <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
    <script>
        window.config = {{vue_config | safe}}; 
    </script>
    <script type="text/javascript" src="{% static 'js/app.js' %}"></script>
  </body>

And inside the VueApp I get the configs from window.config

Is there a better way to do this?

about 4 years ago · Juan Pablo Isaza
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!