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
|
||||
@@ -0,0 +1,65 @@
|
||||
# Internationalization (i18n)
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates how to configure internationalization in uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Locale configuration
|
||||
- Language switching
|
||||
- Component i18n
|
||||
|
||||
### Example: Basic i18n Setup
|
||||
|
||||
```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' // or 'en-us'
|
||||
})
|
||||
return {
|
||||
app
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Language Switching
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button @click="switchLanguage">Switch Language</u-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance } from 'vue'
|
||||
|
||||
const instance = getCurrentInstance()
|
||||
|
||||
const switchLanguage = () => {
|
||||
instance.appContext.config.globalProperties.$u.config({
|
||||
locale: 'en-us'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: Component i18n
|
||||
|
||||
uView Pro components support i18n through global configuration.
|
||||
|
||||
### Key Points
|
||||
|
||||
- Configure locale in main.js
|
||||
- Support zh-cn and en-us
|
||||
- Switch language dynamically
|
||||
- Components automatically use configured locale
|
||||
- Customize locale messages if needed
|
||||
@@ -0,0 +1,80 @@
|
||||
# Installation
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates how to install uView Pro in a uni-app project.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Package installation
|
||||
- uni_modules installation
|
||||
- Easycom configuration
|
||||
- Style import
|
||||
|
||||
### Example: Package Installation
|
||||
|
||||
```bash
|
||||
# Using npm
|
||||
npm install uview-pro
|
||||
|
||||
# Using yarn
|
||||
yarn add uview-pro
|
||||
|
||||
# Using pnpm
|
||||
pnpm add uview-pro
|
||||
```
|
||||
|
||||
### Example: uni_modules Installation
|
||||
|
||||
1. Download from uView Pro official website
|
||||
2. Copy to `uni_modules` directory
|
||||
3. Configure easycom in `pages.json`
|
||||
|
||||
### Example: Easycom Configuration
|
||||
|
||||
```json
|
||||
// pages.json
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-pro/components/u-$1/u-$1.vue"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Main.js Setup
|
||||
|
||||
```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)
|
||||
return {
|
||||
app
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Style Import
|
||||
|
||||
```scss
|
||||
// App.vue or main.js
|
||||
@import 'uview-pro/index.scss';
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Install via npm or uni_modules
|
||||
- Configure easycom for auto-import
|
||||
- Import styles in App.vue or main.js
|
||||
- Use createSSRApp for uni-app
|
||||
- Support Vue 3 Composition API
|
||||
@@ -0,0 +1,49 @@
|
||||
# Introduction
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example provides an introduction to uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- What is uView Pro
|
||||
- Features
|
||||
- Platform support
|
||||
- Comparison with other libraries
|
||||
|
||||
### Example: What is uView Pro
|
||||
|
||||
uView Pro is a Vue 3 component library designed for uni-app development, based on uView 1.8.8 with complete refactoring, supporting Vue 3 and TypeScript.
|
||||
|
||||
### Example: Features
|
||||
|
||||
- **Vue 3 Support**: Built for Vue 3 with Composition API
|
||||
- **TypeScript**: Full TypeScript support
|
||||
- **Multi-platform**: Support Android, iOS, WeChat Mini Program, Alipay Mini Program, etc.
|
||||
- **Rich Components**: 100+ components
|
||||
- **Theme Customization**: Support for theme customization
|
||||
- **i18n**: Internationalization support
|
||||
- **Tools**: Rich utility methods
|
||||
|
||||
### Example: Platform Support
|
||||
|
||||
uView Pro supports:
|
||||
- Android
|
||||
- iOS
|
||||
- WeChat Mini Program
|
||||
- Alipay Mini Program
|
||||
- ByteDance Mini Program
|
||||
- QQ Mini Program
|
||||
- H5
|
||||
- And more
|
||||
|
||||
### Key Points
|
||||
|
||||
- Based on uView 1.8.8, completely refactored
|
||||
- Vue 3 and TypeScript support
|
||||
- Multi-platform compatibility
|
||||
- Rich component ecosystem
|
||||
- Active development and maintenance
|
||||
@@ -0,0 +1,88 @@
|
||||
# Quick Start
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example provides a quick start guide for uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Basic setup
|
||||
- First component
|
||||
- Component usage
|
||||
- Project structure
|
||||
|
||||
### Example: Basic Setup
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-button type="primary">Button</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// Component is auto-imported if using easycom
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: With Options API
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button type="primary" @click="handleClick">
|
||||
Click Me
|
||||
</u-button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
handleClick() {
|
||||
console.log('Button clicked')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: With Composition API
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button type="primary" @click="handleClick">
|
||||
Click Me
|
||||
</u-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const handleClick = () => {
|
||||
console.log('Button clicked')
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: Project Structure
|
||||
|
||||
```
|
||||
project/
|
||||
├── pages/
|
||||
│ └── index/
|
||||
│ ├── index.vue
|
||||
│ └── index.json
|
||||
├── uni_modules/
|
||||
│ └── uview-pro/
|
||||
├── App.vue
|
||||
├── main.js
|
||||
└── pages.json
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Use u- prefix for components
|
||||
- Support both Options API and Composition API
|
||||
- Auto-import with easycom
|
||||
- Import styles globally
|
||||
- Follow uni-app project structure
|
||||
@@ -0,0 +1,75 @@
|
||||
# Theme Customization
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates how to customize uView Pro theme.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Custom class
|
||||
- Custom style
|
||||
- Global theme variables
|
||||
- Style override
|
||||
|
||||
### Example: Custom Class
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button custom-class="my-button">Button</u-button>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.my-button {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### Example: Custom Style
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button :custom-style="{ backgroundColor: '#409eff', color: '#fff' }">
|
||||
Button
|
||||
</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Global Theme Variables
|
||||
|
||||
```scss
|
||||
// uni.scss or App.vue
|
||||
$u-primary: #409eff;
|
||||
$u-success: #67c23a;
|
||||
$u-warning: #e6a23c;
|
||||
$u-error: #f56c6c;
|
||||
$u-info: #909399;
|
||||
```
|
||||
|
||||
### Example: Style Override with :deep()
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button class="custom-button">Button</u-button>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-button {
|
||||
:deep(.u-button) {
|
||||
background-color: #409eff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Use custom-class for class-based styling
|
||||
- Use custom-style for inline styling
|
||||
- Override global theme variables
|
||||
- Use :deep() for style penetration
|
||||
- Support SCSS variables
|
||||
Reference in New Issue
Block a user