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

190
Vistas
How to create forms using VUE?

It is my first day learning VUE, and I'm following a tutorial by freeCodeCamp.org on YTB.

When it comes to the concept of component, the lecturer showed how to create a login form project by using components. I followed exactly what she typed, but the code just didn't run. I'm confused why that happened.

Here is the ytb address: https://www.youtube.com/watch?v=FXpIoQ_rT_c&t=2224s , and the component section started from 00:29:20.

Here are the codes. Can anyone tell the reason plz? thx ahead!

<!DOCTYPE html>
<html>
<head>
<title>vueComponents</title>
<style type="text/css">
    [v-cloak]{
        display: none;
    }
    input {
        margin: 10px;
        display: block;
    }
</style>
</head>
<body>
<div id="app" v-cloak>
    <login-form />
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
    let app=Vue.createApp({
        data():{
            return{
                greeting : 'hello VUE',
            }
        }
    })
    app.component ('login-form',{
        template: ‘
            <form @submit="handleSubmit">
                <h1> {{ title }} </h1>
                <input type="email" />
                <input type="password" />
                <button>Log In</button>
            </form>
            ’,
        data(){
            return{
                title:'Login Form'
            }
        },
        methods:{
            handleSubmit(){
                console.log('submitted')
            }
        }

    })
    app.mount('#app')
</script>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looks like there is an issue with quotes in the template.

Working Demo :

let app = Vue.createApp({
  data() {
    return {
        greeting : 'hello VUE',
        }
  }
})
app.component ('login-form',{
  template: `<form @submit="handleSubmit">
  <h1> {{ title }} </h1>
               <input type="email" />
               <input type="password" />
               <button>Log In</button>
               </form>`,
  data() {
    return {
        title:'Login Form'
    }
    },
  methods:{
    handleSubmit(){
      console.log('submitted')
    }
  }
})
app.mount('#app')
<script src="https://unpkg.com/vue@next"></script>

<div id="app" v-cloak>
    <login-form />
</div>

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