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

229
Views
How to pass a variable in form action url in vuejs

I am trying to pass a variable url in form action but couldn't do so with the following code:

<form action="${url}/auth/login_student" method="POST">
....</form>

EDIT: And in script tag

<script>

export default {
  data() {
    return{
        url: process.env.VUE_APP_URL
    }
  }
}
</script>

I am importing the URL from .env which is 2 folders above this file in hirerachy but it is showing the process.env.VUE_APP_URL is undefined

My .env file code:

VUE_APP_URL=http://localhost:5000
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have to use v-bind to set action to a JavaScript expression. You can then use a template string.

<form :action="`${url}/auth/login_student`" method="POST">
      ^        ^                         ^
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!