<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app">
<button onclick="test()">原生js事件绑定</button>
<button v-on:click="test()">vue事件绑定</button>
<button @click="test()">vue事件绑定简写</button>
</div>
<script src="vue.min.js"></script>
<script>
new Vue({
el:'#app',
data: {
content: 'dsfsfdfasdf'
},
methods: {
test()
{
alert('vue click')
}
}
})
function test()
{
alert('test')
}
</script>
</body>
</html>
13.vue事件绑定
最新推荐文章于 2023-02-25 23:25:24 发布