这里记录v-on:click 的简写

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<script src="https://cdn.jsdelivr.net/npm/vue"></script>
		<title></title>
	</head>

	<body>
		<div id="app">
			<button v-on:click="msg">点击button</button>
			<button v-on:click="msg1">点击button</button>
			<button @click="msg2">点击button</button>
			<button @click="msg3">点击button</button>
		</div>
	</body>
	<script>
		var app = new Vue({
			el: "#app",
			methods: {
				msg: function() {
					alert(1111111111111)
				},

				msg1: function() {
					alert(222222222222222)
				},

				msg2: function() {
					alert(3333333333333)
				},

				msg3: function() {
					alert(444444444444)
				},
			}
		})
	</script>

</html>

 

Logo

前往低代码交流专区

更多推荐