Skip to content

Commit ee6383c

Browse files
committed
docs: auto-import-vite guide
1 parent c4c5221 commit ee6383c

File tree

3 files changed

+62
-23
lines changed

3 files changed

+62
-23
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
2-
<a href="https://www.npmjs.com/package/vue-hooks-plus"
3-
><img src="https://img.shields.io/npm/v/vue-hooks-plus.svg" alt="npm package"
4-
/></a>
2+
<div style="display: flex; align-items: center;">
3+
<h1>VueHooks Plus</h1>
4+
<div style="padding-left: 8px;">
5+
<a href="https://www.npmjs.com/package/vue-hooks-plus"
6+
><img src="https://img.shields.io/npm/v/vue-hooks-plus.svg" alt="npm package"
7+
/></a>
8+
</div>
9+
</div>
510
</template>

packages/hooks/docs/guide/index.en-US.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source:
77
import Badge from '@theme/home/Badge.vue'
88
</script>
99

10-
# VueHooks Plus
10+
<Badge />
1111

1212
Through this chapter, you will know how to quickly start using VueHooks Plus.
1313

@@ -24,10 +24,6 @@ Through this chapter, you will know how to quickly start using VueHooks Plus.
2424
- 🤺 Playground, there's ample scope for one's abilities
2525
- 🔐 Perfect test, safe and reliable
2626

27-
## 📝 Latest Version
28-
29-
<Badge />
30-
3127
## 📦 Install
3228

3329
```bash
@@ -50,17 +46,15 @@ import useRequest from 'vue-hooks-plus/es/useRequest'
5046

5147
### Auto Import
5248

53-
Only `resolver` for `unplugin-auto-import/vite`.
54-
55-
#### Vite
49+
Use `unplugin-auto-import`'s `resolver`
5650

5751
```bash
5852

59-
npm i @vue-hooks-plus/resolvers
53+
npm i -D @vue-hooks-plus/resolvers
6054

6155
```
6256

63-
##### Use
57+
::: details Vite
6458

6559
```typescript
6660
import AutoImport from 'unplugin-auto-import/vite'
@@ -75,6 +69,29 @@ export const AutoImportDeps = () =>
7569
})
7670
```
7771

72+
:::
73+
74+
::: details Webpack
75+
76+
```typescript
77+
const { VueHooksPlusResolver } = require('@vue-hooks-plus/resolvers')
78+
module.exports = {
79+
/* ... */
80+
plugins: [
81+
require('unplugin-auto-import/webpack')({
82+
imports: ['vue', 'vue-router'],
83+
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
84+
dts: 'src/auto-imports.d.ts',
85+
resolvers: [VueHooksPlusResolver()],
86+
}),
87+
],
88+
}
89+
```
90+
91+
:::
92+
93+
For other supported tools, please see [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import)
94+
7895
<br />
7996

8097
## 🧩 Compatible

packages/hooks/docs/guide/index.zh-CN.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source:
77
import Badge from '@theme/home/Badge.vue'
88
</script>
99

10-
# VueHooks Plus
10+
<Badge />
1111

1212
通过该章节,你将了解到如何快速开始使用 VueHooks Plus。
1313

@@ -24,10 +24,6 @@ import Badge from '@theme/home/Badge.vue'
2424
- 🤺 演练场,大有用武之地
2525
- 🔐 测试完善,安全可靠
2626

27-
## 📝 最新版本
28-
29-
<Badge />
30-
3127
## 📦 安装
3228

3329
```bash
@@ -50,17 +46,15 @@ import useRequest from 'vue-hooks-plus/es/useRequest'
5046

5147
### 自动引入
5248

53-
目前只有 `unplugin-auto-import/vite` 下的 `resolver`
54-
55-
#### Vite
49+
使用 `unplugin-auto-import``resolver`
5650

5751
```bash
5852

59-
npm i @vue-hooks-plus/resolvers
53+
npm i -D @vue-hooks-plus/resolvers
6054

6155
```
6256

63-
##### 使用
57+
::: details Vite
6458

6559
```typescript
6660
import AutoImport from 'unplugin-auto-import/vite'
@@ -75,6 +69,29 @@ export const AutoImportDeps = () =>
7569
})
7670
```
7771

72+
:::
73+
74+
::: details Webpack
75+
76+
```typescript
77+
const { VueHooksPlusResolver } = require('@vue-hooks-plus/resolvers')
78+
module.exports = {
79+
/* ... */
80+
plugins: [
81+
require('unplugin-auto-import/webpack')({
82+
imports: ['vue', 'vue-router'],
83+
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
84+
dts: 'src/auto-imports.d.ts',
85+
resolvers: [VueHooksPlusResolver()],
86+
}),
87+
],
88+
}
89+
```
90+
91+
:::
92+
93+
其他支持的工具, 更多请看 [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import)
94+
7895
<br />
7996

8097
## 🧩 兼容

0 commit comments

Comments
 (0)