vitepress-plugin-announcement 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[English](https://github.com/ATQQ/sugar-blog/blob/master/packages/vitepress-plugin-announcement/README-en.md) | 简体中文
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## 使用
|
|
6
8
|
安装依赖 `pnpm/npm/yarn`
|
|
7
9
|
```sh
|
|
@@ -21,21 +23,35 @@ export default defineConfig({
|
|
|
21
23
|
AnnouncementPlugin({
|
|
22
24
|
title: '公告',
|
|
23
25
|
body: [
|
|
24
|
-
{ type: 'text', content: '
|
|
26
|
+
{ type: 'text', content: '👇公众号👇 ---👇 赞赏 👇' },
|
|
25
27
|
{
|
|
26
28
|
type: 'image',
|
|
27
|
-
src: 'https://
|
|
29
|
+
src: 'https://cdn.upyun.sugarat.top/mdImg/sugar/85c9554d023be2fcc5aab94effeef033',
|
|
30
|
+
style: 'display: inline-block;width:46%;padding-right:6px'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'image',
|
|
34
|
+
src: 'https://cdn.upyun.sugarat.top/mdImg/sugar/54eacf3e730af9c1e3542a4800a422ea',
|
|
35
|
+
style: 'display: inline-block;width:46%;padding-left:6px'
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
footer: [
|
|
39
|
+
{
|
|
40
|
+
type: 'text',
|
|
41
|
+
content: 'footer content'
|
|
28
42
|
},
|
|
29
43
|
{
|
|
30
44
|
type: 'button',
|
|
31
45
|
content: '作者博客',
|
|
32
46
|
link: 'https://sugarat.top'
|
|
33
47
|
},
|
|
34
|
-
],
|
|
35
|
-
footer: [
|
|
36
48
|
{
|
|
37
|
-
type: '
|
|
38
|
-
content: '
|
|
49
|
+
type: 'button',
|
|
50
|
+
content: '博客主题',
|
|
51
|
+
link: 'https://theme.sugarat.top',
|
|
52
|
+
props: {
|
|
53
|
+
type: 'success'
|
|
54
|
+
}
|
|
39
55
|
},
|
|
40
56
|
],
|
|
41
57
|
})
|
|
@@ -69,6 +85,39 @@ AnnouncementPlugin({
|
|
|
69
85
|
})
|
|
70
86
|
```
|
|
71
87
|
|
|
88
|
+
### 按钮
|
|
89
|
+
```js
|
|
90
|
+
AnnouncementPlugin({
|
|
91
|
+
title: '公告',
|
|
92
|
+
body: [
|
|
93
|
+
{
|
|
94
|
+
type: 'button',
|
|
95
|
+
content: '博客主题',
|
|
96
|
+
link: 'https://theme.sugarat.top',
|
|
97
|
+
props: {
|
|
98
|
+
type: 'success'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 修改样式
|
|
106
|
+
```js
|
|
107
|
+
AnnouncementPlugin({
|
|
108
|
+
title: '公告',
|
|
109
|
+
body: [
|
|
110
|
+
{
|
|
111
|
+
type: '',
|
|
112
|
+
content: '',
|
|
113
|
+
// ↓↓↓↓↓
|
|
114
|
+
style: 'color: #000; font-size: 16px;'
|
|
115
|
+
// ↑↑↑↑↑
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
```
|
|
120
|
+
|
|
72
121
|
## 完整配置
|
|
73
122
|
```ts
|
|
74
123
|
import type { Ref } from 'vue'
|
|
@@ -164,7 +213,9 @@ export declare namespace Announcement {
|
|
|
164
213
|
link: string
|
|
165
214
|
content: string
|
|
166
215
|
style?: string
|
|
167
|
-
props?:
|
|
216
|
+
props?: {
|
|
217
|
+
type: 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'text' | 'default'
|
|
218
|
+
}
|
|
168
219
|
}
|
|
169
220
|
|
|
170
221
|
export type Value = Title | Text | Image | Button
|
|
@@ -3,15 +3,13 @@ import { computed } from 'vue'
|
|
|
3
3
|
|
|
4
4
|
const props = defineProps<{
|
|
5
5
|
type: 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'text' | 'default'
|
|
6
|
-
onClick?: () => void
|
|
7
|
-
style?: Record<string, any>
|
|
8
6
|
}>()
|
|
9
7
|
|
|
10
8
|
const type = computed(() => props.type ?? 'primary')
|
|
11
9
|
</script>
|
|
12
10
|
|
|
13
11
|
<template>
|
|
14
|
-
<button class="announcement-button" :class="`announcement-button-${type}`"
|
|
12
|
+
<button class="announcement-button" :class="`announcement-button-${type}`">
|
|
15
13
|
<span>
|
|
16
14
|
<slot />
|
|
17
15
|
</span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../src/components/directives.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,CAAC,EAAe,EAAE,OAAY,EAAE,EAAE;QACzC,EAAE,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,CAAC;CACF,CAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
html .theme-blog-popover {
|
|
2
|
+
--box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.1);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
html.dark .theme-blog-popover {
|
|
6
|
+
--box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.6);
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.theme-blog-popover {
|
|
2
10
|
width: 258px;
|
|
3
11
|
position: fixed;
|
|
@@ -7,7 +15,7 @@
|
|
|
7
15
|
box-sizing: border-box;
|
|
8
16
|
border: 1px solid var(--vp-c-brand-3);
|
|
9
17
|
border-radius: 6px;
|
|
10
|
-
background-color:
|
|
18
|
+
background-color: var(--vp-c-bg);
|
|
11
19
|
box-shadow: var(--box-shadow);
|
|
12
20
|
}
|
|
13
21
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/components/util.ts"],"names":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,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,EAAE;QACpC,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,UAAU,CAAA;YAC/B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAA;QACnC,CAAC;IACH,CAAC,EAAE,GAAG,CAAC,CAAA;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QAClE,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,WAAW,CAAC,GAAG,EAAE;QACf,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAClD,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,UAAU,EAAE,CAAA;IACZ,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC1B,CAAC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -79,7 +79,9 @@ declare namespace Announcement {
|
|
|
79
79
|
link: string;
|
|
80
80
|
content: string;
|
|
81
81
|
style?: string;
|
|
82
|
-
props?:
|
|
82
|
+
props?: {
|
|
83
|
+
type: 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'text' | 'default';
|
|
84
|
+
};
|
|
83
85
|
}
|
|
84
86
|
type Value = Title | Text | Image | Button;
|
|
85
87
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -79,7 +79,9 @@ declare namespace Announcement {
|
|
|
79
79
|
link: string;
|
|
80
80
|
content: string;
|
|
81
81
|
style?: string;
|
|
82
|
-
props?:
|
|
82
|
+
props?: {
|
|
83
|
+
type: 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'text' | 'default';
|
|
84
|
+
};
|
|
83
85
|
}
|
|
84
86
|
type Value = Title | Text | Image | Button;
|
|
85
87
|
}
|