mirror of https://github.com/layui/layui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1017 B
37 lines
1017 B
2 years ago
|
<div class="layui-btn-container">
|
||
|
<button class="layui-btn layui-btn-primary demo-dropdown-on" lay-options="{trigger: 'hover'}">
|
||
|
hover
|
||
|
<i class="layui-icon layui-icon-more-vertical layui-font-12"></i>
|
||
|
</button>
|
||
|
<button class="layui-btn layui-btn-primary demo-dropdown-on" lay-options="{trigger: 'mousedown'}">
|
||
|
mousedown
|
||
|
<i class="layui-icon layui-icon-down layui-font-12"></i>
|
||
|
</button>
|
||
|
<button class="layui-btn layui-btn-primary demo-dropdown-on" lay-options="{trigger: 'dblclick'}">
|
||
|
dblclick - 双击
|
||
|
<i class="layui-icon layui-icon-circle layui-font-12"></i>
|
||
|
</button>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
layui.use(function(){
|
||
|
var dropdown = layui.dropdown;
|
||
|
|
||
|
// 自定义事件
|
||
|
dropdown.render({
|
||
|
elem: '.demo-dropdown-on',
|
||
|
// trigger: 'click' // trigger 已配置在元素 `lay-options` 属性上
|
||
|
data: [{
|
||
|
title: 'menu item 1',
|
||
|
id: 100
|
||
|
},{
|
||
|
title: 'menu item 2',
|
||
|
id: 101
|
||
|
},{
|
||
|
title: 'menu item 3',
|
||
|
id: 102
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
});
|
||
|
</script>
|