1、 话不多少 先上代码:  route.js 

  

// 引用模板  分模块编译
const main = r => require.ensure([], () => r(require('../page/main.vue')), 'main')
const home = r => require.ensure([], () => r(require('../page/main.home.vue')), 'home')
const userSpace = r => require.ensure([], () => r(require('../page/main.userSpace.vue')), 'userSpace')
const live = r => require.ensure([], () => r(require('../page/main.live.vue')), 'live')
const lesson = r => require.ensure([], () => r(require('../page/main.lesson.vue')), 'lesson')
const teaching = r => require.ensure([], () => r(require('../page/main.teaching.vue')), 'teaching')
const systemManagement = r => require.ensure([], () => r(require('../page/main.application.vue')), 'userSpace') // 系统管理
const platformInfor = r => require.ensure([], () => r(require('../page/systemManagement/system.platformInfor.vue')), 'platformInfor')
const platformEmail = r => require.ensure([], () => r(require('../page/systemManagement/system.platformEmail.vue')), 'userSpace') // 配置路由
export default [
// 双路由都可跳转到 home
{
path: '/',
redirect: '/home',
component: main,
children: [
{
path: 'home',
component: home
},
{
path: 'userSpace',
component: userSpace
},
]
},
// 双路由都可跳转到 home
{
path: '/:code/', // path前边添加可变路由
redirect: '/:code/home',
component: main,
children: [
{
path: 'home',
component: home
},
{
path: 'userSpace',
component: userSpace
},
{
path: 'live',
component: live
},
{
path: 'lesson',
component: lesson,
children: [
]
},
{
path: 'teaching',
component: teaching
},
{
path: 'systemManagement/',
component: systemManagement,
redirect: 'systemManagement/setUp/platformInfor',
children:[
{
path: 'setUp/platformInfor',
component: platformInfor,
},
{
path: 'setUp/platformEmail',
component: platformEmail
}
]
}
],
}
]

  

  2、global_config.js

  

const Domain = {
location: window.location,
href: window.location.href,
protocol: window.location.protocol,
host: window.location.host,
hostname: window.location.hostname,
port: window.location.port,
search: window.location.search,
hash: window.location.hash
} let baseURL // 配置开发环境和线上生产环境的切换
if (process.env.NODE_ENV == 'development') {
baseURL = 'http://192.168.12.54:8080/';
} else if (process.env.NODE_ENV == 'production') {
baseURL = '/';
} export {Domain, baseURL}

  

    

配置动态加载模块和js分模块打包,生产环境和开发环境公共常量配置的更多相关文章

  1. js动态加载css和js

    之前写了一个工具类点此链接里面含有这段代码,感觉用处挺多,特意提出来 var loadUtil = { /* * 方法说明:[动态加载js文件css文件] * 使用方法:loadUtil.loadjs ...

  2. 用JavaScript动态加载CSS和JS文件

    本文转载自:http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/11/14/2248451.html 今天项目中需要用到动态加载 CSS 文件 ...

  3. 动态加载 移除js file

    动态加载.移除.替换js/css文件 stylesheetjavascriptcssfunctionnull <script language="javascript"> ...

  4. JavaScript动态加载资源【js|css】示例代码

    在开发过程中会用到各种第三方的插件,或者自己写在单独文件中的js方法库或者css样式,在html头部总是需要写一大堆的script和link标签,如果想要自己实现动态的引入资源文件,可以使用开源的re ...

  5. js实用方法记录-js动态加载css、js脚本文件

    js实用方法记录-动态加载css/js 附送一个加载iframe,h5打开app代码 1. 动态加载js文件到head标签并执行回调 方法调用:dynamicLoadJs('http://www.yi ...

  6. JavaScript动态加载CSS和JS文件

    var dynamicLoading = { css: function(path){ if(!path || path.length === 0){ throw new Error('argumen ...

  7. .NET Web后台动态加载Css、JS 文件,换肤方案

    后台动态加载文件代码: //假设css文件:TestCss.css #region 动态加载css文件 public void AddCss() { HtmlGenericControl _CssFi ...

  8. 动态加载css、js引用

    在js代码中动态的加载js.css文件的引用 function addJsCssByLink(type,url) { var doc=document; if(type="js") ...

  9. 动态加载CSS,JS文件

    var Head = document.getElementsByTagName('head')[0],style = document.createElement('style'); //文件全部加 ...

随机推荐

  1. C#删除和清空文件夹的程序

    /// <summary> /// 清空指定的文件夹,但不删除文件夹 /// </summary> /// <param name="dir"> ...

  2. 性能测试 tps持续走低,响应时间持续增加,瓶颈分析

    吞吐量图如上 响应时间图如上 自身压测的机器,资源使用率并没有饱和 服务器,top命令下看到load average的值很低,本身是4核的server. 每个核的CPU使用率也极低,空闲cpu占95+ ...

  3. IDEA配置GIT

    注:此方法可用于配置gitlab也可用于配置github 1.在github中创建一个账号:https://github.com/join?source=header-home 2.下载并安装git: ...

  4. stack_01

    A.添加/移除 A.1.void stack::push(elemValue); // 栈头 添加元素 A.2.void stack::pop(); // 栈头 移除第一个元素 B.随机存取 C.数据 ...

  5. OpenGL入门程序五:三维绘制

    1.现实世界观察一个物体的时候,可能涉及到的三维变化: 1>视图变化------从不同的角度观察. 2>模型变化------移动.旋转物体,计算机中当然还可以对物体进行缩放. 3>投 ...

  6. php-------代码加密的几种方法

    代码加密,也是保护网站安全的一种方法,以下我们来介绍一下如何通过PHP的自定义函数来加密我们的PHP代码. 方法一: <?php function encode_file_contents($f ...

  7. 快速读入fread

    struct FastIO { static const int S = 1e7; int wpos; char wbuf[S]; FastIO() : wpos(0) {} inline int x ...

  8. python-day21--random模块

    >>> import random #随机整数 >>> random.randint(1,5) # 大于等于1且小于等于5之间的整数 >>> ra ...

  9. JSP EL简介

    JSP EL简介:1.语法:    ${expression} 2.[ ]与.运算符    EL 提供“.“和“[ ]“两种运算符来存取数据.     当要存取的属性名称中包含一些特殊字符,如.或?等 ...

  10. 76. Minimum Window Substring *HARD*

    Given a string S and a string T, find the minimum window in S which will contain all the characters ...