vue 阻止输入框冒泡

版权声明:一个被隔壁肥宅嘲笑的... https://blog.csdn.net/weixin_38641550/article/details/83988896

阻止vue的输入框冒泡

vue 阻止事件方法

.stop 

.prevent 

.capture 

.self 

.once

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
		<div id="app">
			{{ message }}
			<div @click.self="show()" style='height: 100px;background: yellow;width: 100px;'>
				<input type="text"/>
			</div>
		</div>
		<script>
			var app = new Vue({
				el: '#app',
				data: {
					message: 'Hello Vue!'
				},
				methods:{
					show(){
						console.log(123123)
					}
				}
			})
		</script>

猜你喜欢

转载自blog.csdn.net/weixin_38641550/article/details/83988896
今日推荐