Skip to content

Commit 9e25d02

Browse files
author
dom
committed
add pwa
1 parent 6ec6a66 commit 9e25d02

20 files changed

+410
-1
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
},
1111
"dependencies": {
1212
"ant-design-vue": "^1.1.9",
13+
"register-service-worker": "^1.5.2",
1314
"vue": "^2.5.17",
1415
"vue-router": "^3.0.1",
1516
"vuex": "^3.0.1"
1617
},
1718
"devDependencies": {
1819
"@vue/cli-plugin-babel": "^3.2.0",
1920
"@vue/cli-plugin-eslint": "^3.2.0",
21+
"@vue/cli-plugin-pwa": "^3.2.0",
2022
"@vue/cli-plugin-unit-jest": "^3.2.0",
2123
"@vue/cli-service": "^3.2.0",
2224
"@vue/eslint-config-standard": "^4.0.0",
9.2 KB
Loading
29.1 KB
Loading
3.29 KB
Loading
3.95 KB
Loading
4.57 KB
Loading
1.46 KB
Loading
1.78 KB
Loading

public/img/icons/apple-touch-icon.png

4.57 KB
Loading

public/img/icons/favicon-16x16.png

799 Bytes
Loading

public/img/icons/favicon-32x32.png

1.24 KB
Loading
1.14 KB
Loading

public/img/icons/mstile-150x150.png

4.18 KB
Loading
+149
Loading

public/manifest.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "vue-tmp",
3+
"short_name": "vue-tmp",
4+
"icons": [
5+
{
6+
"src": "./img/icons/android-chrome-192x192.png",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "./img/icons/android-chrome-512x512.png",
12+
"sizes": "512x512",
13+
"type": "image/png"
14+
}
15+
],
16+
"start_url": "./index.html",
17+
"display": "standalone",
18+
"background_color": "#000000",
19+
"theme_color": "#4DBA87"
20+
}

public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow:

src/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'ant-design-vue/dist/antd.css'
55
import App from './App.vue'
66
import router from './router'
77
import store from './store/index'
8+
import './registerServiceWorker'
89

910
Vue.config.productionTip = false
1011

src/registerServiceWorker.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* eslint-disable no-console */
2+
3+
import { register } from 'register-service-worker'
4+
5+
if (process.env.NODE_ENV === 'production') {
6+
register(`${process.env.BASE_URL}service-worker.js`, {
7+
ready () {
8+
console.log(
9+
'App is being served from cache by a service worker.\n' +
10+
'For more details, visit https://goo.gl/AFskqB'
11+
)
12+
},
13+
registered () {
14+
console.log('Service worker has been registered.')
15+
},
16+
cached () {
17+
console.log('Content has been cached for offline use.')
18+
},
19+
updatefound () {
20+
console.log('New content is downloading.')
21+
},
22+
updated () {
23+
console.log('New content is available; please refresh.')
24+
},
25+
offline () {
26+
console.log('No internet connection found. App is running in offline mode.')
27+
},
28+
error (error) {
29+
console.error('Error during service worker registration:', error)
30+
}
31+
})
32+
}

vue.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
baseUrl: './'
3+
}

0 commit comments

Comments
 (0)