点击事件上加上 .stop, 可以阻止点击事件继续传播 这个地方是阻止继续传播到父元素,因为事件默认在冒泡阶段发生,如果是绑的在捕获阶段发生的事件,.stop是阻止事件继续传播到子元素。.stop 实际上是用的 event.stopPropagation() 这个 api <el-submenu index="1"> <template slot="title"> <i class="el-icon-location" @click.stop="handleIconClick"></i> <span>导航一</span> </template> </el-submenu>
点击事件上加上
.stop
, 可以阻止点击事件继续传播
这个地方是阻止继续传播到父元素,因为事件默认在冒泡阶段发生,
如果是绑的在捕获阶段发生的事件,.stop是阻止事件继续传播到子元素。
.stop
实际上是用的event.stopPropagation()
这个 api