53 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| window.rootPath = (function (src) {
 | |
| 	src = document.currentScript
 | |
| 		? document.currentScript.src
 | |
| 		: document.scripts[document.scripts.length - 1].src;
 | |
| 	return src.substring(0, src.lastIndexOf("/") + 1);
 | |
| 
 | |
| 	// src = document.currentScript
 | |
| 	// 	? document.currentScript.src
 | |
| 	// 	: null;
 | |
| 
 | |
| 	// if (!src) {
 | |
| 	// 	var scriptsArray = [];
 | |
| 	// 	if (document.scripts) {
 | |
| 	// 		for (var i = 0; i < document.scripts.length; i++) {
 | |
| 	// 			var item = document.scripts[i];
 | |
| 
 | |
| 	// 			if (!item.src) { continue; }
 | |
| 
 | |
| 	// 			// 只需要 pear 框架的脚本
 | |
| 	// 			if (item.src.indexOf('/component/pear') === -1) { continue; }
 | |
| 
 | |
| 	// 			scriptsArray.push(item);
 | |
| 	// 		}
 | |
| 	// 	}
 | |
| 	// 	if (scriptsArray.length) {
 | |
| 	// 		src = scriptsArray[scriptsArray.length - 1].src;
 | |
| 	// 	}
 | |
| 	// }
 | |
| 
 | |
| 	// return src ? src.substring(0, src.lastIndexOf("/") + 1) : '';
 | |
| })();
 | |
| 
 | |
| layui.config({
 | |
| 	base: rootPath + "module/",
 | |
| 	version: "4.0.3"
 | |
| }).extend({
 | |
| 	admin: "admin",
 | |
| 	page: "page",
 | |
| 	tabPage: "tabPage",
 | |
| 	menu: "menu",
 | |
| 	fullscreen: "fullscreen",
 | |
| 	messageCenter: "messageCenter",
 | |
| 	menuSearch: "menuSearch",
 | |
| 	button: "button",
 | |
| 	tools: "tools",
 | |
| 	popup: "extends/popup",
 | |
| 	count: "extends/count",
 | |
| 	toast: "extends/toast",
 | |
| 	nprogress: "extends/nprogress",
 | |
| 	echarts: "extends/echarts",
 | |
| 	echartsTheme: "extends/echartsTheme",
 | |
| 	yaml: "extends/yaml"
 | |
| }).use([], function () { }); |