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,84 @@
|
||||
# Button Component
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates the Button component in uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Button types
|
||||
- Button sizes
|
||||
- Button states
|
||||
- Button events
|
||||
|
||||
### Example: Basic Button
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button>Default</u-button>
|
||||
<u-button type="primary">Primary</u-button>
|
||||
<u-button type="success">Success</u-button>
|
||||
<u-button type="info">Info</u-button>
|
||||
<u-button type="warning">Warning</u-button>
|
||||
<u-button type="error">Error</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Button Sizes
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button size="large">Large</u-button>
|
||||
<u-button size="normal">Normal</u-button>
|
||||
<u-button size="small">Small</u-button>
|
||||
<u-button size="mini">Mini</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Button States
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button disabled>Disabled</u-button>
|
||||
<u-button loading>Loading</u-button>
|
||||
<u-button plain>Plain</u-button>
|
||||
<u-button shape="circle">Circle</u-button>
|
||||
<u-button shape="round">Round</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Button Events
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button type="primary" @click="handleClick">
|
||||
Click Me
|
||||
</u-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const handleClick = () => {
|
||||
console.log('Button clicked')
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: Button with Icon
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button icon="search">Search</u-button>
|
||||
<u-button icon="heart" icon-color="#f56c6c">Like</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Multiple types: primary, success, info, warning, error
|
||||
- Multiple sizes: large, normal, small, mini
|
||||
- Support disabled, loading, plain, shape
|
||||
- Icon support
|
||||
- Custom styling with custom-class or custom-style
|
||||
@@ -0,0 +1,106 @@
|
||||
# Form Component
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates the Form component in uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Form structure
|
||||
- Form validation
|
||||
- Form rules
|
||||
- Form submission
|
||||
- Form fields
|
||||
|
||||
### Example: Basic Form
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-form :model="form" label-width="120">
|
||||
<u-form-item label="Name" prop="name">
|
||||
<u-input v-model="form.name" />
|
||||
</u-form-item>
|
||||
<u-form-item label="Email" prop="email">
|
||||
<u-input v-model="form.email" />
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<u-button type="primary" @click="handleSubmit">Submit</u-button>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const form = ref({
|
||||
name: '',
|
||||
email: ''
|
||||
})
|
||||
|
||||
const handleSubmit = () => {
|
||||
console.log('Form:', form.value)
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: Form Validation
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120"
|
||||
>
|
||||
<u-form-item label="Name" prop="name">
|
||||
<u-input v-model="form.name" />
|
||||
</u-form-item>
|
||||
<u-form-item label="Email" prop="email">
|
||||
<u-input v-model="form.email" />
|
||||
</u-form-item>
|
||||
<u-form-item>
|
||||
<u-button type="primary" @click="handleSubmit">Submit</u-button>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const formRef = ref()
|
||||
const form = ref({
|
||||
name: '',
|
||||
email: ''
|
||||
})
|
||||
|
||||
const rules = {
|
||||
name: [
|
||||
{ required: true, message: 'Please input name', trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{ required: true, message: 'Please input email', trigger: 'blur' },
|
||||
{ type: 'email', message: 'Please input valid email', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
console.log('Form valid:', form.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Use :model for form data
|
||||
- Configure :rules for validation
|
||||
- Use prop for form-item validation
|
||||
- Handle form submission
|
||||
- Support form validation methods
|
||||
@@ -0,0 +1,110 @@
|
||||
# Input Component
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates the Input component in uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Input types
|
||||
- Input sizes
|
||||
- Input states
|
||||
- Input events
|
||||
- Input validation
|
||||
|
||||
### Example: Basic Input
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-input v-model="input" placeholder="Please input" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const input = ref('')
|
||||
</script>
|
||||
```
|
||||
|
||||
### Example: Input Types
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-input v-model="text" type="text" />
|
||||
<u-input v-model="number" type="number" />
|
||||
<u-input v-model="password" type="password" :password-icon="true" />
|
||||
<u-input v-model="textarea" type="textarea" :height="100" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Input Sizes
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-input v-model="input1" size="large" />
|
||||
<u-input v-model="input2" size="normal" />
|
||||
<u-input v-model="input3" size="small" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Input States
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-input v-model="input" disabled />
|
||||
<u-input v-model="input" readonly />
|
||||
<u-input v-model="input" :clearable="true" />
|
||||
<u-input v-model="input" :border="true" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Input with Prefix/Suffix
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-input v-model="input1" prefix-icon="search" />
|
||||
<u-input v-model="input2" suffix-icon="arrow-down" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Input Events
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-input
|
||||
v-model="input"
|
||||
@input="handleInput"
|
||||
@change="handleChange"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const input = ref('')
|
||||
|
||||
const handleInput = (value) => {
|
||||
console.log('Input:', value)
|
||||
}
|
||||
const handleChange = (value) => {
|
||||
console.log('Change:', value)
|
||||
}
|
||||
const handleFocus = () => {
|
||||
console.log('Focus')
|
||||
}
|
||||
const handleBlur = () => {
|
||||
console.log('Blur')
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Use v-model for two-way binding
|
||||
- Support multiple input types
|
||||
- Support disabled, readonly, clearable
|
||||
- Prefix and suffix icon support
|
||||
- Multiple event handlers
|
||||
@@ -0,0 +1,54 @@
|
||||
# Components Introduction
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example provides an introduction to uView Pro components.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Component categories
|
||||
- Component list
|
||||
- Component usage
|
||||
- Component features
|
||||
|
||||
### Example: Component Categories
|
||||
|
||||
**Basic Components (基础组件)**:
|
||||
- Button, Icon, Image, Layout, Cell, Badge, Tag, Text, Fab, RootPortal, ConfigProvider
|
||||
|
||||
**Form Components (表单组件)**:
|
||||
- Form, Input, Textarea, Calendar, Select, Keyboard, Picker, Rate, Search, NumberBox, Upload, VerificationCode, Field, Checkbox, Radio, Switch, Slider
|
||||
|
||||
**Data Components (数据组件)**:
|
||||
- CircleProgress, LineProgress, Table, CountDown, CountTo
|
||||
|
||||
**Feedback Components (反馈组件)**:
|
||||
- ActionSheet, AlertTips, Toast, NoticeBar, TopTips, Collapse, Popup, SwipeAction, Modal, FullScreen
|
||||
|
||||
**Layout Components (布局组件)**:
|
||||
- Line, Card, Mask, NoNetwork, Grid, Swiper, TimeLine, Skeleton, Sticky, Waterfall, Divider
|
||||
|
||||
**Navigation Components (导航组件)**:
|
||||
- Dropdown, Tabbar, BackTop, Navbar, Tabs, TabsSwiper, Subsection, IndexList, Steps, Empty, Link, Section, Pagination
|
||||
|
||||
**Other Components (其他组件)**:
|
||||
- MessageInput, Loadmore, ReadMore, LazyLoad, Gap, Avatar, Loading, LoadingPopup, SafeAreaInset, Todo
|
||||
|
||||
### Example: Component Usage
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button type="primary">Button</u-button>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- 100+ components available
|
||||
- Organized by category
|
||||
- Auto-import with easycom
|
||||
- Support Vue 3 Composition API
|
||||
- Consistent API design
|
||||
Reference in New Issue
Block a user