Skip to content

Commit

Permalink
docs: 组件引入增加相关代码示例 (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
1zumii committed Apr 19, 2024
1 parent 08a310d commit bb86934
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions docs/zh/guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,58 @@ import { CloseCircleFilled } from '@fesjs/fes-design/icon';
</script>
```

## 按需
## 组件引入

默认按需
### 全局部分导入

```js
import { FButton } from '@fesjs/fes-design';
app.use(FButton);
```

### 全局完整导入

```js
import FesDesign from '@fesjs/fes-design'
app.use(FesDesign)
```

### 手动导入

```vue
<template>
<FButton>我是 FButton</FButton>
</template>
<script setup>
import { FButton } from '@fesjs/fes-design'
</script>
```

### 按需导入

以 Vite 为例。

```js
// vite.config.ts

import { defineConfig } from 'vite';
import Components from 'unplugin-vue-components/vite';

export default defineConfig({
// ...
plugins: [
Components({
resolvers: [
(componentName) => {
if (componentName.match(/^(F[A-Z]|f-[a-z])/)) {
return {
name: componentName,
from: '@fesjs/fes-design',
};
}
},
],
}),
],
});
```

0 comments on commit bb86934

Please sign in to comment.