配置动态加载模块和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'); //文件全部加 ...
随机推荐
- Android广播接收器里弹出对话框
不多说,直接上车... public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(fina ...
- Linux——用户管理简单学习笔记(三)
用户组管理命令: groupadd -g 888 webadmin 创建用户组webadmin,其GID为888 删除用户组: groupdel 组名 修改用户组信息 groupmod groupmo ...
- python 日期输出附带毫秒
def get_time_stamp(ct): local_time = time.localtime(ct) data_head = time.strftime( time_stamp = &quo ...
- 【Tomcat】tomcat热部署和热加载(转载)
我在项目开发过程中,经常要改动JAVA/JSP 文件,但是又不想从新启动服务器(服务器从新启动花时间),想直接获得(debug)结果.有两种方式热部署 和热加载: 1.热加载:在server.xml ...
- highcharts PHP中使用
官网 https://www.hcharts.cn/demo/highcharts html <div id="container" style="min-widt ...
- node 工程化 web项目
1.结构 node_modules ( ... ) routers ( main.js ) views ( index.html about.HTML 404.html ) ...
- HDU2017新生赛 友好整数
思路: 很简单的一个状态压缩,比赛时没想出来. 最多只有2^10个状态,n^2暴力一下也就1e6. 代码: #include<bits/stdc++.h> using namespace ...
- 在每个节点填充向右的指针 Populating Next Right Pointers in Each Node
2018-08-09 16:01:40 一.Populating Next Right Pointers in Each Node 问题描述: 问题求解: 由于是满二叉树,所以很好填充. public ...
- mybatis: 多对多查询[转]
加入3个包 log4j-1.2.17.jar mybatis-3.3.0.jar mysql-connector-java-5.1.8.jar log4j需要配置 log4j.properties # ...
- eclipse 与 tomcat 的那些路径
我们用mvn创建了一个web工程,同时希望在eclipse里调试开发.mvn有mvn的路径要求,eclispe有eclipse的默认路径,怎么整合二者? 首先介绍一下eclipse的默认路径. 重点在 ...