Browse Source

缓存控制去掉

zhengkaixin 8 tháng trước cách đây
mục cha
commit
e3de765de3
4 tập tin đã thay đổi với 11 bổ sung26 xóa
  1. 3 26
      config/pages.js
  2. 5 0
      index/business/index.html
  3. 1 0
      src/projects/business/main.js
  4. 2 0
      vue.config.js

+ 3 - 26
config/pages.js

@@ -33,10 +33,6 @@ const config = {
 		devServer: {
 			host: '0.0.0.0',
 			port: 8080,
-			//解析缓存
-			disableHostCheck: true,
-			//支持gzip
-			compress: true,
 		},
 		chainWebpack: (config) => {
 			config.entry.app = ['babel-polyfill', '../src/projects/business/main.js']
@@ -55,30 +51,11 @@ const config = {
 			//config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
 		},
 		configureWebpack: config => {
-			//开启gzip压缩,需要配置Nginx服务器gzip选项开启
-			config.plugins.push(
-				new CompressionWebpackPlugin({
-					algorithm: 'gzip', //开启gzip
-					test: /\.js$|\.html$|.\css/, // 匹配文件名
-					threshold: 10240, // 对超过10k的数据压缩
-					deleteOriginalAssets: false // 不删除源文件
-				})
-			);
+			
 
-			config.output.filename = `./static/js/[name].${Timestamp}.js`
-			config.output.chunkFilename = `./static/js/[name].${Timestamp}.js`
+			config.output.filename = `./static/js/[name].${Timestamp}.js?v=${Timestamp}`
+			config.output.chunkFilename = `./static/js/[name].${Timestamp}.js?v=${Timestamp}`
 
-			config.performance = {
-				hints: 'warning',
-				//入口起点的最大体积 整数类型(以字节为单位)
-				maxEntrypointSize: 50000000,
-				//生成文件的最大体积 整数类型(以字节为单位 300k)
-				maxAssetSize: 30000000,
-				//只给出 js 文件的性能提示
-				assetFilter: function(assetFilename) {
-					return assetFilename.endsWith('.js');
-				}
-			}
 		},
 	}
 

+ 5 - 0
index/business/index.html

@@ -1,6 +1,11 @@
 <!DOCTYPE html>
 <html lang="zh-cn">
 	<head>
+		<meta http-equiv="pragma" content="no-cache">
+		<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
+		<meta http-equiv="expires" content="0">
+
+
 		<meta charset="utf-8">
 		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 		<meta http-equiv="X-UA-Compatible" content="IE=edge,IE=IE9">

+ 1 - 0
src/projects/business/main.js

@@ -83,6 +83,7 @@ function getAuthFunList() {
 //console.log(funList)
 
 const checkAuth = (to, from, next) => {
+	
 	if (to.meta != null && to.meta.requireAuth) {
 		if (store.state.person_data || store.state.auth_fun_list) {
 

+ 2 - 0
vue.config.js

@@ -18,6 +18,8 @@ module.exports = {
 	productionSourceMap: false,
 	chainWebpack: conf.chainWebpack,
 	configureWebpack: conf.configureWebpack,
+	
+	
 	css: {
 		extract: {
 			filename: `./static/css/[name].${Timestamp}.css`,