1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-09-10 08:56:41 +08:00

update pwa introduction

This commit is contained in:
lei.jiang 2018-06-28 08:40:18 +08:00
parent 4f10940bc7
commit b3b5e500d2
5 changed files with 35 additions and 8 deletions

View File

@ -44,6 +44,7 @@ export default {
createArticle: 'Create Article',
editArticle: 'Edit Article',
articleList: 'Article List',
pwa: 'PWA',
errorPages: 'Error Pages',
page401: '401',
page404: '404',

View File

@ -44,6 +44,7 @@ export default {
createArticle: '创建文章',
editArticle: '编辑文章',
articleList: '文章列表',
pwa: 'PWA',
errorPages: '错误页面',
page401: '401',
page404: '404',

View File

@ -247,6 +247,13 @@ export const asyncRouterMap = [
]
},
{
path: '/pwa',
component: Layout,
redirect: 'noredirect',
children: [{ path: 'pwa', component: () => import('@/views/pwa/index'), name: 'pwa', meta: { title: 'pwa', icon: 'bug' }}]
},
{
path: '/error-log',
component: Layout,

24
src/views/pwa/index.vue Normal file
View File

@ -0,0 +1,24 @@
<template>
<div class="app-container">
<p>首先你先保证你的浏览器支持PWA,具体可以查看<el-tag style="margin-bottom:20px;"><a href="https://developer.mozilla.org/en-US/Apps/Progressive" target="_blank">MDN</a></el-tag></p>
<p>在此以chrome67.0.3396.99正式版本 32 举例</p>
<p>点击右上角自定义及控制(也就是打开设置那个按钮)</p>
<p>你会发现有一个'安装VUE-ELEMENT-ADMIN...'</p>
<p>如果你想卸载请在浏览器地址栏输入chrome://appsPWA</p>
<p>建议在开发环境注释掉PWA相关文件</p>
</div>
</template>
<script>
/**
Auth: Lei.j1ang
Created: 2018/6/26-18:33
*/
export default {
name: 'pwa'
}
</script>
<style scoped>
</style>

10
sw.js
View File

@ -1,17 +1,11 @@
// configuration
`use strict`
const version = '2.0.0'
const version = '1.0.1'
const CACHE = version + '::PWAsite'
const installFilesEssential = [
'/'
]
// const installFilesEssential = [
// '/',
// './static/tinymce4.7.5/*',
// './manifest.json',
// './build/logo.png'
// ].concat(offlineURL)
// install static assets
function installStaticFiles() {
@ -56,8 +50,8 @@ self.addEventListener('activate', event => {
})
// is image URL?
const iExt = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp']
function isImage(url) {
const iExt = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp']
return iExt.reduce((ret, ext) => ret || url.endsWith(ext), false)
}