<!DOCTYPE html>
<html>
<body>
<div id="app">
<button v-on:click="count++">Add 1</button>count: {{ count }}
<p><button v-on:click="alerthi">Greet</button></p>
<p><button v-on:click="sayhi">Hi</button></p>
<p><a href="1.jsp" v-on:click.prevent.once="alerthi">链接</a></p>
<p><input type="text" v-model:kepup.enter="greet"></p>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
const vm = Vue.createApp({
data() {
return {
count: 0,
message: 'Hello, Vue.js!'
}
},
methods: {
alerthi() {
alert(this.message)
},
sayhi() {
alert('hi!')
}
}
}).mount('#app')
</script>
</body>
</html>
还是不知道是在干啥
<!DOCTYPE html>
<html>
<body>
<div id="app">
<button v-on:click="count++">Add 1</button>count: {{ count }}
<p><button v-on:click="alerthi">Greet</button></p>
<p><button v-on:click="sayhi">Hi</button></p>
<p><a href="1.jsp" v-on:click.prevent.once="alerthi">链接</a></p>
<p><input type="text" @keyup.enter="alerthi"></p>
<p><input type="text" @keyup.17.c="alerthi"></p>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
const vm = Vue.createApp({
data() {
return {
count: 0,
message: 'Hello, Vue.js!'
}
},
methods: {
alerthi() {
alert(this.message)
},
sayhi() {
alert('hi!')
}
}
}).mount('#app')
</script>
</body>
</html>