Form submit and click events behavior

by Trina Lu

HTML

<div id="app">
  <form @submit.prevent="handleSubmit">
    <input type="text" name="phone" placeholder="phone">
    <input type="text" name="code" placeholder="code">
    <button type="button" @click="handleClick('button')">A simple button</button>
    <!-- <button type="submit" @click="handleClick('submit')">A submit button</button> -->
  </form>
</div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
}

Vue

new Vue({
  el: "#app",
 	methods: {
  	handleSubmit() {
    	console.log('submit')
    },
    handleClick(target) {
    	console.log('clicked:' + target)
    }
  }
})