配置动态加载模块和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'); //文件全部加 ...
随机推荐
- LCA在线算法详解
LCA(最近公共祖先)的求法有多种,这里先介绍第一种:在线算法. 声明一下:下面的内容参考了http://www.cnblogs.com/scau20110726/archive/2013/05/26 ...
- python 将16进制转为字节
数值为:0xFD >>> x="FD" >>> x.decode('hex') '\xfd'
- SQL 常用的命令
--修改表名 --格式:SP_RENAME TABLENAME,NEWTABLENAME SP_RENAME TABLENAME,NEWTABLENAME --只能对表,不能对临时表 --修改字段名 ...
- django字段查询参数及聚合函数
字段查询是指如何指定SQL WHERE子句的内容.它们用作QuerySet的filter(), exclude()和get()方法的关键字参数. 默认查找类型为exact. 下表列出了所有的字段查询参 ...
- C#复制文件
string pLocalFilePath ="";//要复制的文件路径 string pSaveFilePath ="";//指定存储的路径 if (File ...
- dns未设置 PHP Warning: file_get_contents():php_network_getaddresses: getaddrinfo failed:
php通过去访问外部网站时,出现以下提示: PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed ...
- 雷林鹏分享:C# 正则表达式
C# 正则表达式 正则表达式 是一种匹配输入文本的模式..Net 框架提供了允许这种匹配的正则表达式引擎.模式由一个或多个字符.运算符和结构组成. 定义正则表达式 下面列出了用于定义正则表达式的各种类 ...
- border可以这样给控件加边框
<Border.BorderBrush> <SolidColorBrush Color="Red" Opacity="0" / ...
- English trip -- VC(情景课)10 B Around the house 在家里
Vocablulary focus 核心词汇 cook play the guitar listen to music watch TV read magazines work in the gar ...
- English trip -- VC(情景课)9 C What are they doing? 他们在做什么?
Grammar focus 语法点: 以What 开头的问句 What is/is/are he/she/they doing? Cutting the grass. Walking the dog. ...