事件冒泡 比如 click

当点击发现会一层一层的

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Porschev---Jquery 事件冒泡</title>

<script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>

</head>
<body>
<form id="form1" runat="server">
  <div id="divOne" onclick="alert('我是最外层');">
    <div id="divTwo" onclick="alert('我是中间层!')">
      <a id="hr_three" href="http://www.baidu.com" mce_href="http://www.baidu.com" onclick="alert('我是最里层!')">点击我</a>
    </div>
  </div>
</form>
</body>
</html>

这个会一层一层的寻找 消耗性能 Vue可以使用@click.stop来停止

 

事件的默认,

有很多标签会有一些默认的操作,Vue使用@click.prevent来阻止事件的默认行为。

posted on 2021-01-15 11:33  晓欲望!  阅读(57)  评论(0)    收藏  举报