配置动态加载模块和js分模块打包,生产环境和开发环境公共常量配置
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分模块打包,生产环境和开发环境公共常量配置的更多相关文章
- js动态加载css和js
之前写了一个工具类点此链接里面含有这段代码,感觉用处挺多,特意提出来 var loadUtil = { /* * 方法说明:[动态加载js文件css文件] * 使用方法:loadUtil.loadjs ...
- 用JavaScript动态加载CSS和JS文件
本文转载自:http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/11/14/2248451.html 今天项目中需要用到动态加载 CSS 文件 ...
- 动态加载 移除js file
动态加载.移除.替换js/css文件 stylesheetjavascriptcssfunctionnull <script language="javascript"> ...
- JavaScript动态加载资源【js|css】示例代码
在开发过程中会用到各种第三方的插件,或者自己写在单独文件中的js方法库或者css样式,在html头部总是需要写一大堆的script和link标签,如果想要自己实现动态的引入资源文件,可以使用开源的re ...
- js实用方法记录-js动态加载css、js脚本文件
js实用方法记录-动态加载css/js 附送一个加载iframe,h5打开app代码 1. 动态加载js文件到head标签并执行回调 方法调用:dynamicLoadJs('http://www.yi ...
- JavaScript动态加载CSS和JS文件
var dynamicLoading = { css: function(path){ if(!path || path.length === 0){ throw new Error('argumen ...
- .NET Web后台动态加载Css、JS 文件,换肤方案
后台动态加载文件代码: //假设css文件:TestCss.css #region 动态加载css文件 public void AddCss() { HtmlGenericControl _CssFi ...
- 动态加载css、js引用
在js代码中动态的加载js.css文件的引用 function addJsCssByLink(type,url) { var doc=document; if(type="js") ...
- 动态加载CSS,JS文件
var Head = document.getElementsByTagName('head')[0],style = document.createElement('style'); //文件全部加 ...
随机推荐
- Elasticsearch 多字段搜索
查询很少是对一个字段做 match 查询,通常都是一个 query 查询多个字段,比如一个 doc 有 title.content.pagetag 等文本字段,要在这些字段查询含多个 term 的 q ...
- python 元组转字符串
tup = ('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's') str = ''.join(tup) print(str)
- Spring 事物机制总结
Spring两种事物处理机制,一是声明式事务,二是编程式事务 声明式事物 1)Spring的声明式事务管理在底层是建立在AOP的基础之上的.其本质是对方法前后进行拦截,然后在目标方法开始之前创建或者加 ...
- Linux忘记root登录密码解决方法
有时候由于长时间米有登录linux系统,等需要用的时候突然忘记root密码,怎么办?下面简单介绍解决方法. redhat 和 centos 6.5 可以,7.0以上未测 在系统重启后,不停地按”e”键 ...
- Git工作区、暂存区和版本库
基本概念 我们先来理解下Git 工作区.暂存区和版本库概念 工作区:就是你在电脑里能看到的目录. 暂存区:英文叫stage, 或index.一般存放在 ".git目录下" 下的in ...
- new JSONObject(str)无法解析 报错:org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject
org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject 解析服务器返回的Jso ...
- 雷林鹏分享:C# 泛型(Generic)
C# 泛型(Generic) 泛型(Generic) 允许您延迟编写类或方法中的编程元素的数据类型的规范,直到实际在程序中使用它的时候.换句话说,泛型允许您编写一个可以与任何数据类型一起工作的类或方法 ...
- SQL 进阶视频课程。Udacity: Intro to Relational Databases和 PostgreSQL语法文档。
Udacity: Intro to Relational Databases The syntax of the select statement with a where clause: selec ...
- EBS R12使用接口表往已存在的供应商地址下创建新的地点
在供应商 "测试供应商A" 下已经有了两个地址,分别为 "地址A","地址B",现在由于某些原因,需要在地址A下面创建新的地点. 由于业务需 ...
- java redis client jedis 测试
package cn.byref.demo1; import java.util.HashMap; import java.util.List; import java.util.Map; impor ...