Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda