<meta name="renderer" content="webkit"> // 作用 指定浏览器默认使用webkit内核 需要了解
浏览器是否支持此段代码
浏览器缓存文件
前端会使用浏览器缓存文件的问题 设置mate 并在引入的 js css文件后添加版本号
如果不生效可能是后台服务器配置了mate ,服务配置的mate会把前端的配置覆盖掉
<script src="/js/userinfo.js?v=201906223715"></script>
<meta http-equiv="Expires" content="0">
<!--设置不缓存页面-->
<meta http-equiv="Pragma" content="no-cache">
<!--设置不修改消息存储-->
<meta http-equiv="Cache-control" content="no-cache">
<!--同上-->
<meta http-equiv="Cache" content="no-cache">
vue 3.0以下可以这样配置添加版本号 vue3.0目前不知道
const Timestamp = new Date().getTime()
module.exports = {
configureWebpack: {
output: { // 输出重构 打包编译后的 文件名称 【模块名称.版本号(可选).时间戳】
filename: `[name].${Timestamp}.js`,
chunkFilename: `[name].${Timestamp}.js`
},
},
css: {
extract: { // 打包后css文件名称添加时间戳
filename: `css/[name].${Timestamp}.css`,
chunkFilename: `css/[name].${Timestamp}.css`
}
},
}
最简单的方法当然是交给后台了 哈哈
让他们去nginx配mate
// nginx配置
location / {
if ($request_filename ~* .*\.(?:htm|html)$) ## 配置页面不缓存html和htm结尾的文件
{
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
root /apps/web/;
index index.html
gzip_static on; // 开启gzip
}
小数精度丢失
保留2位小数数的 防止丢失需要1010的方法来扩展,不能使用*100否则依然会丢失精度,