企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] > [参考](https://layui.itze.cn/doc/base/modules.html) ## 概述 ``` common ├── common.js └── module └── global.js ``` global.js 文件定义全局信息 ``` //提示:模块也可以依赖其它模块,如:layui.define('mod1', callback); layui.define(function(exports){ var obj = { admin_path: "/adminx/", }; //输出 mymod 接口 exports('global', obj); }); ``` common.js ``` var root_path = (function (src) { src = document.currentScript ? document.currentScript.src : document.scripts[document.scripts.length - 1].src; return src.substring(0, src.lastIndexOf("/") + 1); })(); root_path="{/}"+root_path+"/module/" layui.extend({ global: root_path+'global' // {/}的意思即代表采用自有路径,即不跟随 base 路径 }) ```