首先新建一个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. HttpRequest中常见的四种ContentType

    https://www.cnblogs.com/xiaozong/p/5732332.html

  2. Filter实现session超时自动跳转到login页,超过试用期不许登录

    新建一个过滤器 package com.autumn.filter; import com.autumn.pojo.Users; import javax.servlet.*; import java ...

  3. sed:轻量级流编辑器

    一. sed命令 sed是一种几乎包括在所有UNIX平台(包括Linux)的轻量级流编辑器.sed主要是用来将数据进行选取.替换.删除.新增的命令 注意:vi命令只能修改文件,但不能修改命令的结果,如 ...

  4. UVA-10369 Arctic Network (最小生成树)

    题目大意:n个村庄的坐标已知,现在要架光纤使所有的村庄都能上网,但受光纤的参数d所限,每根光纤只能给距离不超过d的村庄之间连接.但是有s个信号机,信号机之间能无限畅连.考虑到光纤的价格和参数d有关,现 ...

  5. HDU 4687 Boke and Tsukkomi 一般图匹配,带花树,思路,输出注意空行 难度:4

    http://acm.hdu.edu.cn/showproblem.php?pid=4687 此题求哪些边在任何一般图极大匹配中都无用,对于任意一条边i,设i的两个端点分别为si,ti, 则任意一个极 ...

  6. bzoj2212

    题解: 线段树合并 比较一下哪一种方案的逆序对少 代码: #include<bits/stdc++.h> using namespace std; ; typedef long long ...

  7. 剑指offer+名企面试官精讲典型编程题,28题扩展题

    body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...

  8. 彻底解决WP的TextBox中文字过长显示不出来的问题

    文字如果过长的话在TextBox中会显示不完全,这个大家都知道了,后来有人做了ExTextblock增强控件,大部分文字是可以显示出来了,不过,在某些情况下还是会有显示不全的情况. 这个时候一个解决方 ...

  9. Chrome即将封杀Google Earth、Google Talk等插件

    昨日,Chrome安全工程师Justin Schuh在官方博客中写道,到明年一月份,谷歌将封杀一系列基于NPAPI框架标准的浏览器插件.其中包括谷歌地球(Google Earth).Google Ta ...

  10. Beta阶段第1周/共2周 Scrum立会报告+燃尽图 01

    作业要求[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2383] 版本控制:https://git.coding.net/liuyy08 ...