Skip to content

Commit b2f308e

Browse files
authored
Merge pull request #72 from InhiblabCore/dev
docs: nav-bar style
2 parents 502bc01 + 995f53a commit b2f308e

File tree

30 files changed

+142
-68
lines changed

30 files changed

+142
-68
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"@types/qs": "^6.9.7",
3434
"@vitejs/plugin-vue": "^2.3.1",
3535
"@vue-hooks-plus/md-demo-plugins": "^1.0.0",
36-
"@vue-hooks-plus/vitepress": "1.1.8",
37-
"@vue-hooks-plus/vitepress-demo-block": "^1.2.7",
36+
"@vue-hooks-plus/vitepress": "1.2.3",
37+
"@vue-hooks-plus/vitepress-demo-block": "^1.3.1",
3838
"@vue/test-utils": "^2.1.0",
3939
"@vitest/coverage-c8":"^0.25.7",
4040
"eslint": "^8.20.0",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<div></div>
3+
</template>
4+
5+
<script lang="ts" setup></script>
6+
7+
<style scoped lang="less"></style>

packages/hooks/docs/.vitepress/config.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,24 @@ export default defineConfig({
7676
nav: [
7777
{ text: 'Hooks', link: '/useRequest/' },
7878
{
79-
text: '演练场',
79+
text: '演武场',
8080
link: 'http://43.138.187.142:9000/vue-hooks-plus/vhp-playground/',
8181
},
8282
isGithub
8383
? {
84-
text: 'Gitee 镜像',
84+
text: '国内镜像 🇨🇳',
8585
link: 'https://inhiblab-core.gitee.io/docs/hooks/',
8686
}
87-
: {
88-
text: 'Github 站点',
89-
link: 'https://inhiblabcore.github.io/docs/hooks/',
90-
},
87+
: null,
88+
// {
89+
// text: 'Github 站点',
90+
// link: 'https://inhiblabcore.github.io/docs/hooks/',
91+
// },
9192
{
9293
text: '发行版本',
9394
link: 'https://github.com/InhiblabCore/vue-hooks-plus/releases/',
9495
},
95-
],
96+
].filter(Boolean),
9697
sidebar: getRouterConfig(),
9798
},
9899
'/en/': {
@@ -104,18 +105,15 @@ export default defineConfig({
104105
},
105106
isGithub
106107
? {
107-
text: 'Gitee Site',
108+
text: 'Gitee Mirror 🇨🇳',
108109
link: 'https://inhiblab-core.gitee.io/docs/hooks/',
109110
}
110-
: {
111-
text: 'Github Site',
112-
link: 'https://inhiblabcore.github.io/docs/hooks/',
113-
},
111+
: null,
114112
{
115113
text: 'Releases',
116114
link: 'https://github.com/InhiblabCore/vue-hooks-plus/releases/',
117115
},
118-
],
116+
].filter(Boolean),
119117
sidebar: getRouterConfig('/en/'),
120118
},
121119
},

packages/hooks/docs/.vitepress/router.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const useRequestRouter = [
148148
link: '/useRequest/scroll/',
149149
},
150150
{
151-
text: '🌟 开发插件',
151+
text: '插件',
152152
link: '/useRequest/plugin/',
153153
},
154154
],
@@ -217,7 +217,7 @@ const useRequestRouterEN = [
217217
link: '/en/useRequest/scroll/',
218218
},
219219
{
220-
text: '🌟 Plugin',
220+
text: 'Plugins',
221221
link: '/en/useRequest/plugin/',
222222
},
223223
],

packages/hooks/docs/.vitepress/theme/var.less

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
rgba(59, 206, 128, 0.7) 26%,
2121
rgba(100, 126, 255, 0.7) 76%
2222
);
23+
24+
--vhp-demo-shadow-color: rgba(0, 0, 0, 0.3);
2325
}
2426

2527
.VPHome {
@@ -42,10 +44,10 @@ input {
4244
}
4345

4446
.vitepress-demo {
45-
border-radius: 15px;
47+
border-radius: 12px;
4648
overflow: hidden;
4749
margin-top: 8px;
48-
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);
50+
box-shadow: 0px 2px 4px var(--vhp-demo-shadow-color);
4951
}
5052

5153
.dark {
@@ -57,6 +59,7 @@ input {
5759
rgba(100, 126, 255, 0.7) 26%,
5860
rgba(59, 206, 128, 0.7) 76%
5961
);
62+
--vhp-demo-shadow-color: rgba(188, 189, 190, 0.3);
6063
}
6164

6265
.vp-doc [class*='language-']:before {

packages/hooks/src/useCookieState/index.en-US.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ const [state, setState]: [State, SetState] = useCookieState(
3838
);
3939
```
4040

41-
Note: If you want to remove this data from the document.cookie, use the `setState()` or `setState (undefined)`.
41+
:::tip Note
42+
43+
If you want to remove this data from the document.cookie, use the `setState()` or `setState (undefined)`.
44+
45+
:::
4246

4347
### Params
4448

packages/hooks/src/useCookieState/index.zh-CN.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ map:
1515
<demo src="./demo/demo.vue"
1616
language="vue"
1717
title="将状态存储在 Cookie 中"
18-
desc="刷新页面后,可以看到输入框中的内容被从 Cookie 中恢复了。">
19-
</demo>
18+
desc="刷新页面后,可以看到输入框中的内容被从 Cookie 中恢复了。"> </demo>
2019

2120
### 高级用法-可接收函数
2221

2322
<demo src="./demo/demo1.vue"
2423
language="vue"
2524
title="set可接收函数"
26-
desc="set的时候可以接收函数进行拓展使用">
27-
</demo>
25+
desc="set的时候可以接收函数进行拓展使用"> </demo>
2826

2927
## API
3028

@@ -40,7 +38,11 @@ const [state, setState]: [State, SetState] = useCookieState(
4038
);
4139
```
4240

43-
注意:如果想从 document.cookie 中删除这条数据,可以使用 `setState()``setState(undefined)`
41+
:::tip 注意
42+
43+
如果想从 document.cookie 中删除这条数据,可以使用 `setState()``setState(undefined)`
44+
45+
:::
4446

4547
### Params
4648

@@ -51,24 +53,24 @@ const [state, setState]: [State, SetState] = useCookieState(
5153

5254
### Result
5355

54-
| 参数 | 说明 | 类型 |
55-
| -------- | -------------- | ----------------------- |
56+
| 参数 | 说明 | 类型 |
57+
| -------- | -------------- | ---------------------------- |
5658
| state | 本地 Cookie 值 | `Ref<string` \| `undefined>` |
57-
| setState | 设置 Cookie 值 | `SetState` |
59+
| setState | 设置 Cookie 值 | `SetState` |
5860

5961
setState 可以更新 cookie options,会与 `useCookieState` 设置的 options 进行 merge 操作。
6062

6163
`const targetOptions = { ...options, ...updateOptions }`
6264

6365
### Options
6466

65-
| 参数 | 说明 | 类型 | 默认值 |
66-
| ------------ | ---------------------------------------------------- | ---------------------------------------------------------- | ----------- |
67-
| defaultValue | 可选,定义 Cookie 默认值,但不同步到本地 Cookie | `string` \| `undefined` \| `(() => (string \| undefined))` | `undefined` |
68-
| expires | 可选,定义 Cookie 存储有效时间 | `number` \| `Date` | - |
69-
| path | 可选,定义 Cookie 可用的路径 | `string` | `/` |
70-
| domain | 可选,定义 Cookie 可用的域,默认为 Cookie 创建的域名 | `string` | - |
71-
| secure | 可选,Cookie 传输是否需要 https 安全协议 | `boolean` | `false` |
72-
| sameSite | 可选,Cookie 不能与跨域请求一起发送 | `strict` \| `lax` \| `none` | - |
67+
| 参数 | 说明 | 类型 | 默认值 |
68+
| --- | --- | --- | --- |
69+
| defaultValue | 可选,定义 Cookie 默认值,但不同步到本地 Cookie | `string` \| `undefined` \| `(() => (string \| undefined))` | `undefined` |
70+
| expires | 可选,定义 Cookie 存储有效时间 | `number` \| `Date` | - |
71+
| path | 可选,定义 Cookie 可用的路径 | `string` | `/` |
72+
| domain | 可选,定义 Cookie 可用的域,默认为 Cookie 创建的域名 | `string` | - |
73+
| secure | 可选,Cookie 传输是否需要 https 安全协议 | `boolean` | `false` |
74+
| sameSite | 可选,Cookie 不能与跨域请求一起发送 | `strict` \| `lax` \| `none` | - |
7375

7476
Options 与 [js-cookie attributes](https://github.com/js-cookie/js-cookie#cookie-attributes) 保持一致。

packages/hooks/src/useLocalStorageState/index.en-US.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const [state, setState] = useLocalStorageState<T>(
5555
| state | Local Storage-value | `Ref<any` \| `undefined>` |
5656
| setState | Set Storage value | `SetState` |
5757
58-
## Remark
58+
:::warning Remark
5959
6060
useLocalStorageState will call `serializer` before write data to localStorage, and call `deserializer` once after read data.
61+
62+
:::

packages/hooks/src/useLocalStorageState/index.zh-CN.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const [state, setState] = useLocalStorageState<T>(
5555
| state | 本地 Storage 值 | `Ref<any` \| `undefined>` |
5656
| setState | 设置 Storage 值 | `SetState` |
5757
58-
## 注意
58+
:::warning 注意
5959
6060
useLocalStorageState 在往 localStorage 写入数据前,会先调用一次 `serializer`,在读取数据之后,会先调用一次 `deserializer`
61+
62+
:::

packages/hooks/src/useRequest/docs/basic/index.en-US.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,8 @@ const {
201201
| onError | Triggered when service reject | `(e: Error, params: TParams) => void` | - |
202202
| onFinally | Triggered when service execution is complete | `(params: TParams, data?: TData, e?: Error) => void` | - |
203203

204+
:::info 🛸 PRO
205+
204206
Above we have introduced the most basic functionalities of useRequest, and then we will introduce some more advanced functionalities.
207+
208+
:::

0 commit comments

Comments
 (0)