一、反例
<Dropdown class ="m-btn-style" style="margin-left: 10px"> <Button type="primary"> 添加菜单 <Icon type="md-arrow-dropdown"/> </Button> <Dropdown-menu slot="list"> <Dropdown-item @on-click="addMenu()">添加顶栏菜单</Dropdown-item> <Dropdown-item @on-click="addMenu()">添加子菜单</Dropdown-item> </Dropdown-menu> </Dropdown>
addMenu(name){ alert(name) }
发现点击无效
二、正例
事件位置别写错啦
<Dropdown class ="m-btn-style" @on-click="addMenu" style="margin-left: 10px"> <Button type="primary"> 添加菜单 <Icon type="md-arrow-dropdown"/> </Button> <Dropdown-menu slot="list"> <Dropdown-item name="top-menu" >添加顶栏菜单</Dropdown-item> <Dropdown-item name="children-menu">添加子菜单</Dropdown-item> </Dropdown-menu> </Dropdown>
addMenu(name){ alert(name) }
SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
标签:菜单,name,Dropdown,addMenu,点击,添加,events,iView From: https://www.cnblogs.com/mangoubiubiu/p/17020450.html