Created
August 11, 2020 02:10
-
-
Save PKTseng/c0ec73fdb2be9ee2cb0ac91e25070a5c to your computer and use it in GitHub Desktop.
checkbox-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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