Vue

by yshrkn

HTML

<div id="app">
  <form action="">
    <label for="name">名前</label>
    <input type="text" name="name" id="name" v-model=name><br>
    <label for="mail">メールアドレス</label>
    <input type="mail" name="mail" id="mail" v-model='mail'><br> 
    <button type='submit' @click=send>submit</button>
  </form>
</div>

CSS

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

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

li {
  margin: 8px 0;
}

h2 {
  font-weight: bold;
  margin-bottom: 15px;
}

del {
  color: rgba(0, 0, 0, 0.3);
}

Vue

new Vue({
  el: "#app",
  data: {
		name: '初期データ1',
    mail: '初期データ2',
  },
  methods: {
  	send(){
    	alert(`送信しました。
      名前:${this.name}
      メールアドレス: ${this.mail}`);
    }
  }
})