mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-09-12 16:40:40 +08:00
refactor: 架构升级
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Configuration
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates how to configure uView Pro globally.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Global config options
|
||||
- ConfigProvider
|
||||
- Theme configuration
|
||||
- Component configuration
|
||||
|
||||
### Example: Global Config
|
||||
|
||||
```javascript
|
||||
// main.js
|
||||
import { createSSRApp } from 'vue'
|
||||
import uView from 'uview-pro'
|
||||
import App from './App.vue'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(uView, {
|
||||
locale: 'zh-cn',
|
||||
theme: 'light'
|
||||
})
|
||||
return {
|
||||
app
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Using ConfigProvider
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-config-provider :theme="theme" :locale="locale">
|
||||
<u-button>Button</u-button>
|
||||
</u-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const theme = ref('light')
|
||||
const locale = ref('zh-cn')
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: Component Config
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button :config="{ size: 'large' }">Button</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Configure globally via app.use()
|
||||
- Use ConfigProvider for component-level config
|
||||
- Support theme and locale configuration
|
||||
- Component-level config available
|
||||
- Follow uni-app configuration patterns
|
||||
Reference in New Issue
Block a user