mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-09-10 21:30:14 +08:00
update pwa introduction
This commit is contained in:
parent
4f10940bc7
commit
b3b5e500d2
@ -44,6 +44,7 @@ export default {
|
|||||||
createArticle: 'Create Article',
|
createArticle: 'Create Article',
|
||||||
editArticle: 'Edit Article',
|
editArticle: 'Edit Article',
|
||||||
articleList: 'Article List',
|
articleList: 'Article List',
|
||||||
|
pwa: 'PWA',
|
||||||
errorPages: 'Error Pages',
|
errorPages: 'Error Pages',
|
||||||
page401: '401',
|
page401: '401',
|
||||||
page404: '404',
|
page404: '404',
|
||||||
|
@ -44,6 +44,7 @@ export default {
|
|||||||
createArticle: '创建文章',
|
createArticle: '创建文章',
|
||||||
editArticle: '编辑文章',
|
editArticle: '编辑文章',
|
||||||
articleList: '文章列表',
|
articleList: '文章列表',
|
||||||
|
pwa: 'PWA',
|
||||||
errorPages: '错误页面',
|
errorPages: '错误页面',
|
||||||
page401: '401',
|
page401: '401',
|
||||||
page404: '404',
|
page404: '404',
|
||||||
|
@ -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',
|
path: '/error-log',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
24
src/views/pwa/index.vue
Normal file
24
src/views/pwa/index.vue
Normal 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://apps,右击安装的PWA图标卸载</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
10
sw.js
@ -1,17 +1,11 @@
|
|||||||
// configuration
|
// configuration
|
||||||
`use strict`
|
`use strict`
|
||||||
|
|
||||||
const version = '2.0.0'
|
const version = '1.0.1'
|
||||||
const CACHE = version + '::PWAsite'
|
const CACHE = version + '::PWAsite'
|
||||||
const installFilesEssential = [
|
const installFilesEssential = [
|
||||||
'/'
|
'/'
|
||||||
]
|
]
|
||||||
// const installFilesEssential = [
|
|
||||||
// '/',
|
|
||||||
// './static/tinymce4.7.5/*',
|
|
||||||
// './manifest.json',
|
|
||||||
// './build/logo.png'
|
|
||||||
// ].concat(offlineURL)
|
|
||||||
|
|
||||||
// install static assets
|
// install static assets
|
||||||
function installStaticFiles() {
|
function installStaticFiles() {
|
||||||
@ -56,8 +50,8 @@ self.addEventListener('activate', event => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// is image URL?
|
// is image URL?
|
||||||
const iExt = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp']
|
|
||||||
function isImage(url) {
|
function isImage(url) {
|
||||||
|
const iExt = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp']
|
||||||
return iExt.reduce((ret, ext) => ret || url.endsWith(ext), false)
|
return iExt.reduce((ret, ext) => ret || url.endsWith(ext), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user