Skip to content

Instantly share code, notes, and snippets.

@PKTseng
Created August 11, 2020 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PKTseng/c0ec73fdb2be9ee2cb0ac91e25070a5c to your computer and use it in GitHub Desktop.
Save PKTseng/c0ec73fdb2be9ee2cb0ac91e25070a5c to your computer and use it in GitHub Desktop.
checkbox-1
<div id="app">
<input type="checkbox" id="chk" v-model="agree">
<label for="chk">agree</label>
<h1>{{agree}}</h1>
<button @click="submit">submit</button>
</div>
new Vue({
el:"#app",
data:{
agree: false,
},
methods:{
submit(){
if( this.agree !== true){
alert('agreeeeeeee');
return
}
// 表單送出後要做的事情...
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment