Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zys8119/vitejs-plugin-config-auto-import
vite + vue3 配置分类自动导入
https://github.com/zys8119/vitejs-plugin-config-auto-import
Last synced: 10 days ago
JSON representation
vite + vue3 配置分类自动导入
- Host: GitHub
- URL: https://github.com/zys8119/vitejs-plugin-config-auto-import
- Owner: zys8119
- Created: 2023-08-10T08:36:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-11T09:29:04.000Z (over 1 year ago)
- Last Synced: 2023-08-11T15:49:33.633Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vitejs-plugin-config-auto-import
vite + vue3 配置分类自动导入## 安装
`npm i vitejs-plugin-config-auto-import`
## 使用
#### Vite
vite.config.ts
```typescript
import {defineConfig} from "vite"
import ConfigAutoImport from "vitejs-plugin-config-auto-import/vite"export default defineConfig({
plugins:[
ConfigAutoImport({
// globalName:string // 全局变量字段名称, 默认 $config
// globalActive:string // 当前全局类别, 默认 test
// globalData:Record // 全局数据配置源 默认 {test:{}}
// configTypeName:string // 当前类别强制重写类型字段名称, 默认 $type
})
]
// ....
})
```
#### Vue> 内置vue3 ComponentCustomProperties ,如需要 ComponentCustomProperties使用请在main注入插件
main.ts
```typescript
import {createApp} from "vue"
import App from "./App.vue"
import ConfigAutoImport from "vitejs-plugin-config-auto-import"
const app = createApp(App)
// ...
app.use(ConfigAutoImport)
app.mount('#app')
```