4-4 Vue 给组件绑定原生事件
发布日期:2021-05-07 10:43:43 浏览次数:21 分类:原创文章

本文共 553 字,大约阅读时间需要 1 分钟。

<!DOCTYPE html><html><head>	<title>4-4 Vue 给组件绑定原生事件</title>	<script src="vue.js"></script></head><body>	<!--        1.native 定义原生事件,不是自定义组件事件    -->	<div id="app">        <chlid @click.native="handleClick"></chlid>	</div>    <script type="text/javascript">       //定义全局子组件       Vue.component('chlid',{            template:"<div>Chlid</div>"       })        //父组件		var app = new Vue({			el:'#app',            methods:{                handleClick:function(){                    alert('native')                }            }		})			</script></body></html>

 

上一篇:2021-5-3课程——E-R模型练习
下一篇:4-3 Vue 组件参数校验与非props特性

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2025年03月18日 11时56分25秒