File tree Expand file tree Collapse file tree 2 files changed +114
-2
lines changed Expand file tree Collapse file tree 2 files changed +114
-2
lines changed Original file line number Diff line number Diff line change 1
1
# pwa-popup
2
2
3
- > TODO
3
+ > @vuepress/plugin-pwa-popup
4
+
5
+ Provide a popup component for users to activate the new PWA service worker manually.
6
+
7
+ This plugin must be used together with [ pwa plugin] ( ./pwa.md ) , and the ` skipWaiting ` option must not be set to ` true ` .
8
+
9
+ When the new service worker is ready, a popup will appear in the right bottom of the page to ask users to activate the waiting service worker.
10
+
11
+ ## Options
12
+
13
+ ### locales
14
+
15
+ - Type: ` Record<string, { message: string, buttonText: string }> `
16
+
17
+ - Details:
18
+
19
+ The messages of the popup in different locales.
20
+
21
+ If this option is not specified, it will fallback to default messages.
22
+
23
+ - Example:
24
+
25
+ ``` js
26
+ module .exports = {
27
+ plugins: [
28
+ [' @vuepress/plugin-pwa' ],
29
+ [
30
+ ' @vuepress/plugin-pwa-popup' ,
31
+ {
32
+ locales: {
33
+ ' /' : {
34
+ message: ' New content is available.' ,
35
+ buttonText: ' Refresh' ,
36
+ },
37
+ ' /zh/' : {
38
+ message: ' 发现新内容可用' ,
39
+ buttonText: ' 刷新' ,
40
+ },
41
+ },
42
+ },
43
+ ],
44
+ ],
45
+ }
46
+ ```
47
+
48
+ - Also see:
49
+ - [ Guide > I18n] ( ../../guide/i18n.md )
50
+
51
+ ## Styles
52
+
53
+ You can customize the style of the popup via CSS variables:
54
+
55
+ ``` css
56
+ :root {
57
+ --pwa-popup-color : #3eaf7c ;
58
+ }
59
+ ```
Original file line number Diff line number Diff line change 1
1
# pwa-popup
2
2
3
- > TODO
3
+ > @vuepress/plugin-pwa-popup
4
+
5
+ 提供一个弹窗组件,允许用户手动刷新 PWA Service Worker 。
6
+
7
+ 该插件必须和 [ pwa 插件] ( ./pwa.md ) 一起使用,并且 ` skipWaiting ` 配置项不能设置为 ` true ` 。
8
+
9
+ 当新的 Service Worker 就绪时,会在页面右下角出现一个弹窗,询问用户是否需要激活处于 Waiting 状态的 Service Worker 。
10
+
11
+ ## 配置项
12
+
13
+ ### locales
14
+
15
+ - 类型: ` Record<string, { message: string, buttonText: string }> `
16
+
17
+ - 详情:
18
+
19
+ 弹窗在不同 locales 下的信息。
20
+
21
+ 如果没有指定该配置项,它会降级使用默认信息。
22
+
23
+ - 示例:
24
+
25
+ ``` js
26
+ module .exports = {
27
+ plugins: [
28
+ [' @vuepress/plugin-pwa' ],
29
+ [
30
+ ' @vuepress/plugin-pwa-popup' ,
31
+ {
32
+ locales: {
33
+ ' /' : {
34
+ message: ' New content is available.' ,
35
+ buttonText: ' Refresh' ,
36
+ },
37
+ ' /zh/' : {
38
+ message: ' 发现新内容可用' ,
39
+ buttonText: ' 刷新' ,
40
+ },
41
+ },
42
+ },
43
+ ],
44
+ ],
45
+ }
46
+ ```
47
+
48
+ - 参考:
49
+ - [ 指南 > 多语言支持] ( ../../guide/i18n.md )
50
+
51
+ ## 样式
52
+
53
+ 你可以通过 CSS 变量来自定义弹窗的样式:
54
+
55
+ ``` css
56
+ :root {
57
+ --pwa-popup-color : #3eaf7c ;
58
+ }
59
+ ```
You can’t perform that action at this time.
0 commit comments