博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
公共文件模块include
阅读量:4879 次
发布时间:2019-06-11

本文共 4794 字,大约阅读时间需要 15 分钟。

首先新建一个include

把所有引入的文件放入公共文件里

function getBaseURL() {

var pathName = window.document.location.pathname;
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
return location.protocol + "//" + location.hostname +
(location.port && ":" + location.port) + projectName + "/";
}

var httpUrl = getBaseURL(); // 公网服务器请求地址

var baseUrl = getBaseURL();

// CSS

document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/awesome/css/font-awesome.min.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap-table.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap-dialog.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/toastr/toastr.min.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/select2/select2.min.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap-treeview/bootstrap-treeview.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/jquery/css/jquery.datetimepicker.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'module/common/utstyle.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'module/common/style.css">');

// JS

document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery-1.11.3.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/underscore.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap/js/bootstrap.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/page-jdmc.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/constant.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-table/js/bootstrap-table.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap/js/bootstrap-dialog.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.validate.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/toastr/toastr.min.js"></script>');

// select2插件

document.write('<script type="text/javascript" src="' + baseUrl + 'resources/select2/select2.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/select2/i18n/zh-CN.js"></script>');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/jquery/jquery.editable-select.min.css">');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.editable-select.min.js"></script>');

document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-treeview/bootstrap-treeview.js"></script>');

document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrapValidator/js/bootstrapValidator.min.js"></script>');

// 滚动条修改

document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/mCustomScrollbar/css/jquery.mCustomScrollbar.css">');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/mCustomScrollbar/jquery.mousewheel.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/mCustomScrollbar/jquery.mCustomScrollbar.min.js"></script>');

// 时间控件
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.datetimepicker.full.min.js"></script>');

// 视频播放

document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/video-player/mediaelementplayer.css">');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/video-player/mediaelement-and-player.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/video-player/lang/zh-cn.js"></script>')

//layer
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/layer/layer.js"></script>');
// backbone.js
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/backbone.js"></script>');
// vue.js
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/vue/vue.min.js"></script>')

// 公用js
document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/tool.js"></script>');

转载于:https://www.cnblogs.com/benmumu/p/9378478.html

你可能感兴趣的文章
MySQL-ERROR 2003
查看>>
SQL Server2012-SSIS的包管理和部署
查看>>
JavaScript内置对象
查看>>
如何把js的循环写成异步的
查看>>
ER图是啥?
查看>>
too many include files depth = 1024错误原因
查看>>
HTTP协议详解(三)
查看>>
Android零基础入门第84节:引入Fragment原来是这么回事
查看>>
解析SQL Server之任务调度
查看>>
参考资料地址
查看>>
08.路由规则中定义参数
查看>>
Pandas截取列部分字符,并据此修改另一列的数据
查看>>
java.lang.IllegalArgumentException
查看>>
【Spark】编程实战之模拟SparkRPC原理实现自定义RPC
查看>>
接口实现观察者模式
查看>>
四则运算完结篇
查看>>
Objective-C中的类目,延展,协议
查看>>
Python标准模块--Iterators和Generators
查看>>
Introduction Sockets to Programming in C using TCP/IP
查看>>
PHP 简单实现webSocket
查看>>