SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>layui-extend</title>
	<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/sentsin/layui@2.5.7/dist/css/layui.css">
	<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/MicroAnswer/layui_dropdown@2.3.2/dist/dropdown.css">
</head>
<body>
    <div style="margin: 20px;">
        <!-- 先还是写好触发按钮,可以看到通过 templateMenu 配置,指定了一个要使用的模板。 -->
        <button class="layui-btn" lay-dropdown="{templateMenu: '#myMenus'}">下拉菜单</button>
        <!-- 定义菜单模板 -->
        <script id="myMenus" type="text/plain">
        [
            [{txt: "个人中心", event: "usercenter"}]
            [hr]
            [{txt: "详细信息", event: "detail"}]
            [{txt: "退出登录", event: "logout"}]
        ]
        </script>
    </div>
	<script src="//cdn.jsdelivr.net/gh/sentsin/layui@2.5.7/dist/layui.js"></script>
    <script>
        layui.extend({
            dropdown: '{/}//cdn.jsdelivr.net/gh/MicroAnswer/layui_dropdown@2.3.2/dist/dropdown'
        }).use(['dropdown'], function() {
            var dropdown = layui.dropdown;
        });
    </script>
</body>
</html>