iView Dropdown events 设置点击事件无效

一、反例

复制代码
                    <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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

本文作者:KwFruit

本文链接:https://www.cnblogs.com/mangoubiubiu/p/17020450.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   KwFruit  阅读(229)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起