This commit is contained in:
lei.jiang 2018-06-27 22:32:03 +08:00
parent 934132a6df
commit 6a5be79bea
2 changed files with 3 additions and 2 deletions

View File

@ -70,6 +70,7 @@ const webpackConfig = merge(baseWebpackConfig, {
favicon: resolve('favicon.ico'), favicon: resolve('favicon.ico'),
title: 'vue-element-admin', title: 'vue-element-admin',
path: config.build.assetsPublicPath + config.build.assetsSubDirectory, path: config.build.assetsPublicPath + config.build.assetsSubDirectory,
pwaPath: config.build.assetsPublicPath,
minify: { minify: {
removeComments: true, removeComments: true,
collapseWhitespace: true, collapseWhitespace: true,

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="manifest" href="<%= htmlWebpackPlugin.options.pwaPath %>/manifest.json"> <link rel="manifest" href="<%= htmlWebpackPlugin.options.pwaPath %>manifest.json">
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>vue-element-admin</title> <title>vue-element-admin</title>
@ -15,7 +15,7 @@
</body> </body>
<script> <script>
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('<%= htmlWebpackPlugin.options.pwaPath %>/sw.js').then(function(registration) { navigator.serviceWorker.register('<%= htmlWebpackPlugin.options.pwaPath %>sw.js').then(function(registration) {
// Registration Success // Registration Success
console.log('[serviceWorker]: registration successful with scope: ', registration.scope) console.log('[serviceWorker]: registration successful with scope: ', registration.scope)
}).catch(function(err) { }).catch(function(err) {