标签:cal mic view body html max use ice ref
//位于js/compent.js中
//compent.js 自定义layui模块 layui.define(function(exports){ var obj ={ hello:function(){ } } exports("compent",obj); //输出本模块的访问接口为compent对象 });
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>自定义模块</title> <link rel="stylesheet" href="layui/css/layui.css"> </head> <body> <!-- 你的HTML代码 --> <script src="layui/layui.js"></script> <script> //全局配置 layui.config({ base:‘js/‘ //全局定义自定义模块的根目录 }).extend({ compent:‘compent‘ //拓展模块为compent }) //加载模块 layui.use([‘layer‘,‘compent‘],function(){ var layer = layui.layer; var compent = layui.compent; layer.msg("风继续吹!"); compent.hello(); }) </script> </body> </html>
实例目录:
标签:cal mic view body html max use ice ref
原文地址:https://www.cnblogs.com/nanfengnan/p/14350105.html