首先新建一个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>');

公共文件模块include的更多相关文章

  1. thinkphp 的两种建构模式 第一种一个单入口里面定义两个模块,前台和后台,函数控制模块必须function.php前台加载前台模块的汉书配置文件,后台加载后台模块的汉书配置文件,公共文件共用。第二种架构模式两个单入口文件,分别生成两个应用定义define。。。函数可以定义配置文件。。。。

    thinkphp 的两种建构模式  第一种一个单入口里面定义两个模块,前台和后台,函数控制模块必须function.php前台加载前台模块的汉书配置文件,后台加载后台模块的汉书配置文件,公共文件共用. ...

  2. gulp批量打包文件并提取公共文件

    gulp是前端开发过程中对代码进行构建的工具,是自动化项目的构建利器. browseriyf是模块化打包工具. 一般情况下,Browserify 会把所有的模块打包成单个文件.单个文件在大多数情况下是 ...

  3. Node文件模块

    在上一篇文章中有提到,Node模块分为核心模块和文件模块,接下来就简单总结一下文件模块. 文件模块则是在运行时动态加载,需要完整的路径分析.文件定位.编译执行过程.速度相比核心模块稍微慢一些,但是用的 ...

  4. browserify 不打包某些文件或者把公共文件提取出来教程

    var gulp = require('gulp') var fs = require("fs") var babelify = require('babelify') var b ...

  5. 【直接拿来用のandroid公共代码模块解析与分享】の Notification和NotificationManager

    本文源代码托管在https://github.com/ASCE1885/asce-common,欢迎fork Android项目做得多了.会发现原来非常多基础的东西都是能够复用,这个系列介绍一些自己项 ...

  6. 系统中异常公共处理模块 in spring boot

    最近在用spring boot 做微服务,所以对于异常信息的 [友好展示]有要求,我设计了两点: 一. 在业务逻辑代码中,异常的抛出 我做了限定,一般只会是三种: 1. OmcException // ...

  7. ansible文件模块使用

    1. 文件组装模块-assemble assemble主要是将多份配置文件组装为一份配置文件. 参数 必填 默认 选项 说明 Backup 否 No Yes/no 是否创建备份文件,使用时间戳 Del ...

  8. php学习笔记6--php中的文件包含 include,require,include_once,require_once

    php中的文件包含 include,require,include_once,require_once 文件包含:是指将一个文件的内容包含进另外一个文件,有利于代码的复用等.php中文件包含指令有4个 ...

  9. 微信小程序:import导入公共文件方式

    wxss: @import "../common/ali_icon.wxss"; wxml: 公共文件(位置:../common/head.wxml)如下---- <temp ...

随机推荐

  1. .net core部署到linux

    1.Install the .NET SDK 我的服务器是腾讯云的Ubuntu 16 注册Microsoft密钥和订阅源 wget -q https://packages.microsoft.com/ ...

  2. JavaScript---详解cookie

    1.什么是cookie? 在讨论cookie之前,需要知道“会话跟踪”这个概念. 1. 什么是会话  客户端打开与服务器的连接发出请求到服务器响应客户端请求的全过程称之为会话 2. 什么是会话跟踪  ...

  3. Hosts 文件的作用

    问题来源: 我修改了hosts文件访问公司的内网  但是出现错误找不到服务器或DNS错误  一个下午了都上不了公司的系统. Hosts是什么?Hosts是Window系统目录里的一个文件,它的作用可大 ...

  4. 创建目录mkdir

    mkdir -p 在创建目录时,我们通常会先检查一下是否存在,如果不存在,就创建,这个时候通常用mkdir -p进行,但是-p是干什么用的呢. mkdir --help一下吧.也就说,如果上级目录不存 ...

  5. C#读写 AB PLC 直接通过节点来读写数据 读写 AllenBradley PLC

    本文将使用一个Github开源的组件库技术来读写AB PLC,使用的是基于以太网的实现,不需要额外的组件,读取操作只要放到后台线程就不会卡死线程,本组件支持超级方便的高性能读写操作 官网:http:/ ...

  6. Linux运维学习笔记-软硬链接知识总结

    文件链接   硬链接,通过索引节点来进行链接 硬链接原理图 硬链接的创建: 直接执行命令“ln 源文件 硬链接文件”,即可完成创建硬链接. 硬链接知识小结: 1.具有相同Inode节点号的多个文件是互 ...

  7. Ubuntu用户管理

    本文主要介绍Ubuntu的用户管理,包括建立和删除用户,用户授权等 ================== 创建用户并授权================== sudo adduser xxx 会在ho ...

  8. start-stop-daemon自动启动、关闭后台程序参数传递

    /************************************************************************* * start-stop-daemon自动启动.关 ...

  9. TCP滑动窗口与回退N针协议

    [转]TCP 滑动窗口协议/1比特滑动窗口协议/后退n协议/选择重传协议 2014-1-5阅读884 评论0 本文转自 http://www.cnblogs.com/ulihj/archive/201 ...

  10. Spring集成Mybatis(Dao方式开发)

    Spring整成Mybatis注意事项:  1. 关键jar包不能少 2.可以单独整理好Mybatis框架,测试无误再集成Spring 3.集成时,参数级别的细节可以选择忽略,但思路必须清晰 代码如下 ...