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

186
Views
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 answers
Answer question

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 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!