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,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,273 @@
|
||||
---
|
||||
name: uview-pro-vue3
|
||||
description: Provides comprehensive guidance for uView Pro Vue 3 component library including components, tools, layouts, and templates. Use when the user asks about uView Pro, needs to build Vue 3 applications with uView Pro, or implement mobile-first UI components.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
## When to use this skill
|
||||
|
||||
Use this skill whenever the user wants to:
|
||||
- Install and set up uView Pro in a uni-app project
|
||||
- Use uView Pro components in Vue 3 / uni-app applications
|
||||
- Configure uView Pro (theme, i18n, etc.)
|
||||
- Use form components (Button, Input, Form, etc.)
|
||||
- Use data display components (List, Card, etc.)
|
||||
- Use feedback components (Toast, Modal, etc.)
|
||||
- Use navigation components (Tabs, NavBar, etc.)
|
||||
- Use uView Pro tools and utilities
|
||||
- Use uView Pro layout templates
|
||||
- Customize component styles and themes
|
||||
- Handle component events
|
||||
- Understand uView Pro API and methods
|
||||
- Troubleshoot uView Pro issues
|
||||
|
||||
## How to use this skill
|
||||
|
||||
This skill is organized to match the uView Pro official documentation structure (https://uviewpro.cn/, https://uviewpro.cn/zh/guide/intro.html, https://uviewpro.cn/zh/components/intro.html, https://uviewpro.cn/zh/tools/intro.html, https://uviewpro.cn/zh/layout/intro.html). When working with uView Pro:
|
||||
|
||||
1. **Identify the topic** from the user's request:
|
||||
- Installation/安装 → `examples/guide/installation.md`
|
||||
- Quick Start/快速开始 → `examples/guide/quick-start.md`
|
||||
- Components/组件 → `examples/components/`
|
||||
- Tools/工具 → `examples/tools/`
|
||||
- Layout/布局 → `examples/layout/`
|
||||
- API/API 文档 → `api/`
|
||||
|
||||
2. **Load the appropriate example file** from the `examples/` directory:
|
||||
|
||||
**Guide (使用指南)**:
|
||||
- `examples/guide/intro.md` - Introduction
|
||||
- `examples/guide/installation.md` - Installation guide
|
||||
- `examples/guide/quick-start.md` - Quick start guide
|
||||
- `examples/guide/theme.md` - Theme customization
|
||||
- `examples/guide/i18n.md` - Internationalization
|
||||
- `examples/guide/config.md` - Configuration
|
||||
|
||||
**Components (组件)**:
|
||||
- `examples/components/intro.md` - Components introduction
|
||||
- `examples/components/button.md` - Button component
|
||||
- `examples/components/input.md` - Input component
|
||||
- `examples/components/form.md` - Form component
|
||||
- `examples/components/list.md` - List component
|
||||
- `examples/components/card.md` - Card component
|
||||
- `examples/components/toast.md` - Toast component
|
||||
- `examples/components/modal.md` - Modal component
|
||||
- `examples/components/tabs.md` - Tabs component
|
||||
- `examples/components/navbar.md` - NavBar component
|
||||
- `examples/components/date-picker.md` - DatePicker component
|
||||
- `examples/components/select.md` - Select component
|
||||
- `examples/components/switch.md` - Switch component
|
||||
- `examples/components/checkbox.md` - Checkbox component
|
||||
- `examples/components/radio.md` - Radio component
|
||||
- `examples/components/upload.md` - Upload component
|
||||
- `examples/components/pagination.md` - Pagination component
|
||||
- `examples/components/avatar.md` - Avatar component
|
||||
- `examples/components/badge.md` - Badge component
|
||||
- `examples/components/tag.md` - Tag component
|
||||
- `examples/components/empty.md` - Empty component
|
||||
- `examples/components/loading.md` - Loading component
|
||||
- `examples/components/popup.md` - Popup component
|
||||
- `examples/components/dropdown.md` - Dropdown component
|
||||
- `examples/components/drawer.md` - Drawer component
|
||||
|
||||
**Tools (工具)**:
|
||||
- `examples/tools/intro.md` - Tools introduction
|
||||
- `examples/tools/http.md` - HTTP request
|
||||
- `examples/tools/storage.md` - Storage utilities
|
||||
- `examples/tools/router.md` - Router utilities
|
||||
- `examples/tools/validator.md` - Validator utilities
|
||||
- `examples/tools/format.md` - Format utilities
|
||||
- `examples/tools/color.md` - Color utilities
|
||||
|
||||
**Layout (布局)**:
|
||||
- `examples/layout/intro.md` - Layout introduction
|
||||
- `examples/layout/grid.md` - Grid layout
|
||||
- `examples/layout/flex.md` - Flex layout
|
||||
- `examples/layout/container.md` - Container layout
|
||||
|
||||
3. **Follow the specific instructions** in that example file for syntax, structure, and best practices
|
||||
|
||||
**Important Notes**:
|
||||
- uView Pro is for Vue 3 and uni-app
|
||||
- Components use Vue 3 Composition API
|
||||
- Examples include both Options API and Composition API
|
||||
- Each example file includes key concepts, code examples, and key points
|
||||
|
||||
4. **Reference API documentation** in the `api/` directory when needed:
|
||||
- `api/component-api.md` - Component API reference
|
||||
- `api/props-and-events.md` - Props and events reference
|
||||
- `api/tools-api.md` - Tools API reference
|
||||
- `api/config-api.md` - Configuration API
|
||||
|
||||
5. **Use templates** from the `templates/` directory:
|
||||
- `templates/installation.md` - Installation templates
|
||||
- `templates/component-usage.md` - Component usage templates
|
||||
- `templates/project-setup.md` - Project setup templates
|
||||
|
||||
### 1. Understanding uView Pro
|
||||
|
||||
uView Pro is a Vue 3 component library designed for uni-app development, providing rich components and utility methods.
|
||||
|
||||
**Key Concepts**:
|
||||
- **Vue 3 Support**: Built for Vue 3 with Composition API
|
||||
- **uni-app Support**: Optimized for uni-app development
|
||||
- **Rich Components**: 100+ components for various use cases
|
||||
- **Theme Customization**: Support for theme customization
|
||||
- **i18n**: Internationalization support
|
||||
- **Tools**: Rich utility methods
|
||||
|
||||
### 2. Installation
|
||||
|
||||
**Using npm**:
|
||||
|
||||
```bash
|
||||
npm install uview-pro
|
||||
```
|
||||
|
||||
**Using yarn**:
|
||||
|
||||
```bash
|
||||
yarn add uview-pro
|
||||
```
|
||||
|
||||
**Using pnpm**:
|
||||
|
||||
```bash
|
||||
pnpm add uview-pro
|
||||
```
|
||||
|
||||
### 3. Basic 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
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Doc mapping (one-to-one with official documentation)
|
||||
|
||||
**Guide (指南)**:
|
||||
- See guide files in `examples/guide/` or `examples/getting-started/` → https://uviewpro.cn/zh/guide/intro.html
|
||||
|
||||
**Components (组件)**:
|
||||
- See component files in `examples/components/` → https://uviewpro.cn/zh/components/intro.html
|
||||
|
||||
## Examples and Templates
|
||||
|
||||
This skill includes detailed examples organized to match the official documentation structure. All examples are in the `examples/` directory (see mapping above).
|
||||
|
||||
**To use examples:**
|
||||
- Identify the topic from the user's request
|
||||
- Load the appropriate example file from the mapping above
|
||||
- Follow the instructions, syntax, and best practices in that file
|
||||
- Adapt the code examples to your specific use case
|
||||
|
||||
**To use templates:**
|
||||
- Reference templates in `templates/` directory for common scaffolding
|
||||
- Adapt templates to your specific needs and coding style
|
||||
|
||||
## API Reference
|
||||
|
||||
Detailed API documentation is available in the `api/` directory, organized to match the official uView Pro API documentation structure:
|
||||
|
||||
### Component API (`api/component-api.md`)
|
||||
- Component props and events
|
||||
- Component methods
|
||||
- Component slots
|
||||
|
||||
### Props and Events (`api/props-and-events.md`)
|
||||
- Common props
|
||||
- Common events
|
||||
- Event handling
|
||||
|
||||
### Tools API (`api/tools-api.md`)
|
||||
- HTTP request methods
|
||||
- Storage methods
|
||||
- Router methods
|
||||
- Validator methods
|
||||
- Format methods
|
||||
- Color methods
|
||||
|
||||
### Configuration API (`api/config-api.md`)
|
||||
- Global configuration options
|
||||
- Theme configuration
|
||||
- i18n configuration
|
||||
|
||||
**To use API reference:**
|
||||
1. Identify the API you need help with
|
||||
2. Load the corresponding API file from the `api/` directory
|
||||
3. Find the API signature, parameters, return type, and examples
|
||||
4. Reference the linked example files for detailed usage patterns
|
||||
5. All API files include links to relevant example files in the `examples/` directory
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use on-demand import**: Import only the components you need to reduce bundle size
|
||||
2. **Use Composition API**: Prefer Composition API for better code organization
|
||||
3. **Handle events properly**: Use proper event handlers for component interactions
|
||||
4. **Customize theme**: Use theme variables for customization
|
||||
5. **Follow design specs**: Follow uView Pro design specifications
|
||||
6. **Use tools**: Leverage uView Pro tools for common operations
|
||||
7. **Use layouts**: Use layout templates for consistent page structure
|
||||
|
||||
## Resources
|
||||
|
||||
- **Official Documentation**: https://uviewpro.cn/
|
||||
- **Guide**: https://uviewpro.cn/zh/guide/intro.html
|
||||
- **Components**: https://uviewpro.cn/zh/components/intro.html
|
||||
- **Tools**: https://uviewpro.cn/zh/tools/intro.html
|
||||
- **Layout**: https://uviewpro.cn/zh/layout/intro.html
|
||||
|
||||
## Keywords
|
||||
|
||||
uView Pro, uview-pro, Vue 3, Vue3, uni-app, UI components, component library, 组件库, 按钮, 表单, 列表, 卡片, 提示, 弹窗, 标签页, 导航栏, 日期选择器, 选择器, 开关, 复选框, 单选框, 上传, 分页, 头像, 徽标, 标签, 空状态, 加载, 弹出层, 下拉菜单, 抽屉, HTTP, 存储, 路由, 验证, 格式化, 颜色, 网格布局, 弹性布局, 容器布局, Button, Form, List, Card, Toast, Modal, Tabs, NavBar, DatePicker, Select, Switch, Checkbox, Radio, Upload, Pagination, Avatar, Badge, Tag, Empty, Loading, Popup, Dropdown, Drawer
|
||||
|
||||
## 能力边界
|
||||
|
||||
### ✅ 适用场景
|
||||
- 当你需要使用此技能对应的技术栈时
|
||||
- 当项目需要遵循最佳实践时
|
||||
- 当需要快速上手或深入理解核心概念时
|
||||
|
||||
### ⚠️ 需要注意
|
||||
- 复杂业务逻辑需要结合具体场景调整
|
||||
- 性能优化需要根据实际数据量评估
|
||||
|
||||
### ❌ 不适用场景
|
||||
- 不相关的技术栈或框架
|
||||
- 需要完全自定义的特殊场景
|
||||
|
||||
## 常见陷阱 (Gotchas)
|
||||
|
||||
1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异
|
||||
2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查
|
||||
3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码
|
||||
4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本
|
||||
5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题
|
||||
|
||||
## 使用流程
|
||||
|
||||
### Step 1: 环境准备
|
||||
确保开发环境已安装必要的依赖和工具。
|
||||
|
||||
### Step 2: 配置初始化
|
||||
根据项目需求进行基础配置。
|
||||
|
||||
### Step 3: 核心功能使用
|
||||
按照示例代码实现核心功能。
|
||||
|
||||
### Step 4: 测试验证
|
||||
运行测试确保功能正常。
|
||||
|
||||
### Step 5: 部署上线
|
||||
完成开发后进行部署和监控。
|
||||
@@ -0,0 +1,71 @@
|
||||
# Component API
|
||||
|
||||
## API Reference
|
||||
|
||||
uView Pro component props, events, and methods.
|
||||
|
||||
### Common Props
|
||||
|
||||
Most components support:
|
||||
- `custom-class` - Custom class name
|
||||
- `custom-style` - Custom style object
|
||||
- `disabled` - Disabled state
|
||||
|
||||
### Common Events
|
||||
|
||||
Most components emit:
|
||||
- `@click` - Click event
|
||||
- `@change` - Change event
|
||||
- `@focus` - Focus event
|
||||
- `@blur` - Blur event
|
||||
|
||||
### Button Component
|
||||
|
||||
**Props:**
|
||||
- `type` - Button type (primary, success, info, warning, error)
|
||||
- `size` - Button size (large, normal, small, mini)
|
||||
- `disabled` - Disabled state
|
||||
- `loading` - Loading state
|
||||
- `plain` - Plain button
|
||||
- `shape` - Button shape (circle, round)
|
||||
- `icon` - Icon name
|
||||
|
||||
**Events:**
|
||||
- `@click` - Click event
|
||||
|
||||
### Input Component
|
||||
|
||||
**Props:**
|
||||
- `v-model` - Input value
|
||||
- `type` - Input type (text, number, password, textarea)
|
||||
- `size` - Input size (large, normal, small)
|
||||
- `disabled` - Disabled state
|
||||
- `readonly` - Readonly state
|
||||
- `clearable` - Show clear button
|
||||
- `border` - Show border
|
||||
- `prefix-icon` - Prefix icon
|
||||
- `suffix-icon` - Suffix icon
|
||||
|
||||
**Events:**
|
||||
- `@input` - Input event
|
||||
- `@change` - Change event
|
||||
- `@focus` - Focus event
|
||||
- `@blur` - Blur event
|
||||
|
||||
### Form Component
|
||||
|
||||
**Props:**
|
||||
- `model` - Form data object
|
||||
- `rules` - Validation rules
|
||||
- `label-width` - Label width
|
||||
|
||||
**Methods:**
|
||||
- `validate` - Validate form
|
||||
- `validateField` - Validate specific field
|
||||
- `resetFields` - Reset form fields
|
||||
- `clearValidate` - Clear validation
|
||||
|
||||
**Events:**
|
||||
- `@validate` - Validation event
|
||||
|
||||
**See also:** `examples/components/` for detailed component examples
|
||||
@@ -0,0 +1,80 @@
|
||||
# Configuration API
|
||||
|
||||
## API Reference
|
||||
|
||||
uView Pro global configuration options.
|
||||
|
||||
### Global Config Options
|
||||
|
||||
When using `app.use(uView, options)`, you can pass:
|
||||
|
||||
```typescript
|
||||
interface uViewOptions {
|
||||
locale?: string
|
||||
theme?: string
|
||||
}
|
||||
```
|
||||
|
||||
### ConfigProvider Props
|
||||
|
||||
**Props:**
|
||||
- `locale` - Global locale (zh-cn, en-us)
|
||||
- `theme` - Global theme (light, dark)
|
||||
|
||||
### Example: Global Config
|
||||
|
||||
```javascript
|
||||
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: ConfigProvider
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-config-provider :locale="locale" :theme="theme">
|
||||
<u-button>Button</u-button>
|
||||
</u-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const locale = ref('zh-cn')
|
||||
const theme = ref('light')
|
||||
</script>
|
||||
```
|
||||
|
||||
### Locale Configuration
|
||||
|
||||
**Options:**
|
||||
- `'zh-cn'` - Chinese (Simplified)
|
||||
- `'en-us'` - English (US)
|
||||
|
||||
### Theme Configuration
|
||||
|
||||
**Options:**
|
||||
- `'light'` - Light theme
|
||||
- `'dark'` - Dark theme
|
||||
|
||||
### Component Config
|
||||
|
||||
Components can be configured individually:
|
||||
|
||||
```vue
|
||||
<u-button :config="{ size: 'large' }">Button</u-button>
|
||||
```
|
||||
|
||||
**See also:** `examples/guide/config.md` for configuration examples
|
||||
@@ -0,0 +1,95 @@
|
||||
# Props and Events
|
||||
|
||||
## API Reference
|
||||
|
||||
Common props and events in uView Pro components.
|
||||
|
||||
### Common Props
|
||||
|
||||
#### custom-class
|
||||
|
||||
**Type:** `string`
|
||||
|
||||
Custom CSS class name.
|
||||
|
||||
#### custom-style
|
||||
|
||||
**Type:** `string | object`
|
||||
|
||||
Custom inline style.
|
||||
|
||||
#### disabled
|
||||
|
||||
**Type:** `boolean`
|
||||
|
||||
**Default:** `false`
|
||||
|
||||
Whether component is disabled.
|
||||
|
||||
### Common Events
|
||||
|
||||
#### @click
|
||||
|
||||
**Type:** `Function`
|
||||
|
||||
Click event handler.
|
||||
|
||||
**Example:**
|
||||
```vue
|
||||
<u-button @click="handleClick">Button</u-button>
|
||||
```
|
||||
|
||||
#### @change
|
||||
|
||||
**Type:** `Function`
|
||||
|
||||
Change event handler.
|
||||
|
||||
**Example:**
|
||||
```vue
|
||||
<u-input v-model="value" @change="handleChange" />
|
||||
```
|
||||
|
||||
#### @focus
|
||||
|
||||
**Type:** `Function`
|
||||
|
||||
Focus event handler.
|
||||
|
||||
**Example:**
|
||||
```vue
|
||||
<u-input @focus="handleFocus" />
|
||||
```
|
||||
|
||||
#### @blur
|
||||
|
||||
**Type:** `Function`
|
||||
|
||||
Blur event handler.
|
||||
|
||||
**Example:**
|
||||
```vue
|
||||
<u-input @blur="handleBlur" />
|
||||
```
|
||||
|
||||
### Event Object
|
||||
|
||||
Event handlers receive an event object:
|
||||
|
||||
```javascript
|
||||
handleEvent(event) {
|
||||
// event.target - Target element
|
||||
// event.currentTarget - Current target element
|
||||
// event.detail - Event detail (component-specific)
|
||||
}
|
||||
```
|
||||
|
||||
### Component-Specific Events
|
||||
|
||||
Different components emit different events:
|
||||
- **Input**: @input, @change, @focus, @blur
|
||||
- **Select**: @change, @open, @close
|
||||
- **Form**: @validate
|
||||
- **Button**: @click
|
||||
|
||||
**See also:** `examples/components/` for component-specific examples
|
||||
@@ -0,0 +1,69 @@
|
||||
# Tools API
|
||||
|
||||
## API Reference
|
||||
|
||||
uView Pro tools and utility methods.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
**request(options)**
|
||||
- `url` - Request URL
|
||||
- `method` - Request method (GET, POST, PUT, DELETE)
|
||||
- `data` - Request data
|
||||
- `header` - Request headers
|
||||
- `timeout` - Request timeout
|
||||
|
||||
**Interceptors:**
|
||||
- `request.interceptors.request.use()` - Request interceptor
|
||||
- `request.interceptors.response.use()` - Response interceptor
|
||||
|
||||
### Storage
|
||||
|
||||
**setStorage(key, value)**
|
||||
- Set storage value
|
||||
|
||||
**getStorage(key)**
|
||||
- Get storage value
|
||||
|
||||
**removeStorage(key)**
|
||||
- Remove storage value
|
||||
|
||||
**clearStorage()**
|
||||
- Clear all storage
|
||||
|
||||
### Router
|
||||
|
||||
**navigateTo(options)**
|
||||
- Navigate to page
|
||||
|
||||
**redirectTo(options)**
|
||||
- Redirect to page
|
||||
|
||||
**navigateBack(options)**
|
||||
- Navigate back
|
||||
|
||||
**switchTab(options)**
|
||||
- Switch tab
|
||||
|
||||
### Validator
|
||||
|
||||
**validate(value, rules)**
|
||||
- Validate value with rules
|
||||
|
||||
### Format
|
||||
|
||||
**formatDate(date, format)**
|
||||
- Format date
|
||||
|
||||
**formatNumber(number, format)**
|
||||
- Format number
|
||||
|
||||
### Color
|
||||
|
||||
**colorToRgb(color)**
|
||||
- Convert color to RGB
|
||||
|
||||
**colorToHex(color)**
|
||||
- Convert color to HEX
|
||||
|
||||
**See also:** `examples/tools/` for detailed tool examples
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,77 @@
|
||||
# Layout Introduction
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example provides an introduction to uView Pro layout templates.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Layout categories
|
||||
- Layout usage
|
||||
- Responsive layout
|
||||
|
||||
### Example: Layout Categories
|
||||
|
||||
**Grid Layout (网格布局)**:
|
||||
- Grid system
|
||||
- Responsive grid
|
||||
- Grid columns
|
||||
|
||||
**Flex Layout (弹性布局)**:
|
||||
- Flex container
|
||||
- Flex items
|
||||
- Flex direction
|
||||
|
||||
**Container Layout (容器布局)**:
|
||||
- Container
|
||||
- Header
|
||||
- Content
|
||||
- Footer
|
||||
|
||||
### Example: Grid Layout
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-grid :col="3">
|
||||
<u-grid-item>
|
||||
<view>Item 1</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item>
|
||||
<view>Item 2</view>
|
||||
</u-grid-item>
|
||||
<u-grid-item>
|
||||
<view>Item 3</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Example: Flex Layout
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<view class="flex-container">
|
||||
<view class="flex-item">Item 1</view>
|
||||
<view class="flex-item">Item 2</view>
|
||||
<view class="flex-item">Item 3</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.flex-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Multiple layout options
|
||||
- Responsive design
|
||||
- Easy to use
|
||||
- Well documented
|
||||
- Flexible configuration
|
||||
@@ -0,0 +1,101 @@
|
||||
# HTTP Request
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example demonstrates HTTP request utilities in uView Pro.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Request methods
|
||||
- Request interceptors
|
||||
- Response interceptors
|
||||
- Error handling
|
||||
|
||||
### Example: Basic Request
|
||||
|
||||
```javascript
|
||||
import { request } from 'uview-pro'
|
||||
|
||||
request({
|
||||
url: '/api/user',
|
||||
method: 'GET'
|
||||
}).then(res => {
|
||||
console.log('Response:', res)
|
||||
}).catch(err => {
|
||||
console.error('Error:', err)
|
||||
})
|
||||
```
|
||||
|
||||
### Example: POST Request
|
||||
|
||||
```javascript
|
||||
import { request } from 'uview-pro'
|
||||
|
||||
request({
|
||||
url: '/api/user',
|
||||
method: 'POST',
|
||||
data: {
|
||||
name: 'John',
|
||||
email: 'john@example.com'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('Response:', res)
|
||||
})
|
||||
```
|
||||
|
||||
### Example: Request Interceptor
|
||||
|
||||
```javascript
|
||||
import { request } from 'uview-pro'
|
||||
|
||||
request.interceptors.request.use(config => {
|
||||
// Add token
|
||||
config.header = {
|
||||
...config.header,
|
||||
'Authorization': 'Bearer token'
|
||||
}
|
||||
return config
|
||||
})
|
||||
```
|
||||
|
||||
### Example: Response Interceptor
|
||||
|
||||
```javascript
|
||||
import { request } from 'uview-pro'
|
||||
|
||||
request.interceptors.response.use(
|
||||
response => {
|
||||
return response.data
|
||||
},
|
||||
error => {
|
||||
console.error('Request error:', error)
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### Example: Request Config
|
||||
|
||||
```javascript
|
||||
import { request } from 'uview-pro'
|
||||
|
||||
request({
|
||||
url: '/api/user',
|
||||
method: 'GET',
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
timeout: 10000
|
||||
})
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Support GET, POST, PUT, DELETE methods
|
||||
- Request and response interceptors
|
||||
- Error handling
|
||||
- Configurable timeout
|
||||
- Support custom headers
|
||||
@@ -0,0 +1,73 @@
|
||||
# Tools Introduction
|
||||
|
||||
**官方文档**: https://uviewpro.cn
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
This example provides an introduction to uView Pro tools and utilities.
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- Tool categories
|
||||
- Tool usage
|
||||
- Tool methods
|
||||
|
||||
### Example: Tool Categories
|
||||
|
||||
**HTTP Request (HTTP 请求)**:
|
||||
- Request methods
|
||||
- Request interceptors
|
||||
- Response interceptors
|
||||
|
||||
**Storage (存储)**:
|
||||
- setStorage, getStorage
|
||||
- removeStorage, clearStorage
|
||||
|
||||
**Router (路由)**:
|
||||
- navigateTo, redirectTo
|
||||
- navigateBack, switchTab
|
||||
|
||||
**Validator (验证)**:
|
||||
- Validation methods
|
||||
- Form validation
|
||||
|
||||
**Format (格式化)**:
|
||||
- Date format
|
||||
- Number format
|
||||
- Text format
|
||||
|
||||
**Color (颜色)**:
|
||||
- Color conversion
|
||||
- Color utilities
|
||||
|
||||
### Example: Using Tools
|
||||
|
||||
```javascript
|
||||
// HTTP Request
|
||||
import { request } from 'uview-pro'
|
||||
|
||||
request({
|
||||
url: '/api/user',
|
||||
method: 'GET'
|
||||
})
|
||||
|
||||
// Storage
|
||||
import { setStorage, getStorage } from 'uview-pro'
|
||||
|
||||
setStorage('key', 'value')
|
||||
const value = getStorage('key')
|
||||
|
||||
// Router
|
||||
import { navigateTo } from 'uview-pro'
|
||||
|
||||
navigateTo('/pages/index/index')
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Rich utility methods
|
||||
- Easy to use
|
||||
- Well documented
|
||||
- TypeScript support
|
||||
- Optimized for uni-app
|
||||
@@ -0,0 +1,103 @@
|
||||
# Component Usage Templates
|
||||
|
||||
## Button Usage
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button type="primary" @click="handleClick">
|
||||
Click Me
|
||||
</u-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const handleClick = () => {
|
||||
console.log('Clicked')
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## Form Usage
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-form :model="form" :rules="rules" ref="formRef">
|
||||
<u-form-item label="Name" prop="name">
|
||||
<u-input v-model="form.name" />
|
||||
</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: ''
|
||||
})
|
||||
|
||||
const rules = {
|
||||
name: [
|
||||
{ required: true, message: 'Please input name', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
console.log('Form:', form.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## List Usage
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-list>
|
||||
<u-list-item
|
||||
v-for="(item, index) in items"
|
||||
:key="index"
|
||||
@click="handleItemClick(item)"
|
||||
>
|
||||
{{ item.title }}
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const items = ref([
|
||||
{ title: 'Item 1' },
|
||||
{ title: 'Item 2' }
|
||||
])
|
||||
|
||||
const handleItemClick = (item) => {
|
||||
console.log('Item:', item)
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## Toast Usage
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<u-button @click="showToast">Show Toast</u-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { showToast } from 'uview-pro'
|
||||
|
||||
const showToast = () => {
|
||||
showToast({
|
||||
title: 'Success',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
```
|
||||
@@ -0,0 +1,56 @@
|
||||
# Installation Templates
|
||||
|
||||
## npm Installation
|
||||
|
||||
```bash
|
||||
npm install uview-pro
|
||||
```
|
||||
|
||||
## Easycom Configuration
|
||||
|
||||
```json
|
||||
// pages.json
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-pro/components/u-$1/u-$1.vue"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 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
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Style Import
|
||||
|
||||
```scss
|
||||
// App.vue
|
||||
@import 'uview-pro/index.scss';
|
||||
```
|
||||
|
||||
## Complete Setup
|
||||
|
||||
```bash
|
||||
# Install
|
||||
npm install uview-pro
|
||||
|
||||
# Configure easycom in pages.json
|
||||
# Import in main.js
|
||||
# Import styles in App.vue
|
||||
```
|
||||
@@ -0,0 +1,70 @@
|
||||
# Project Setup Templates
|
||||
|
||||
## uni-app Project Setup
|
||||
|
||||
```bash
|
||||
# Create uni-app project
|
||||
# Using HBuilderX or CLI
|
||||
|
||||
# Install uView Pro
|
||||
npm install uview-pro
|
||||
```
|
||||
|
||||
## pages.json Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-pro/components/u-$1/u-$1.vue"
|
||||
}
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## main.js Setup
|
||||
|
||||
```javascript
|
||||
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
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## App.vue Setup
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<view id="app">
|
||||
<!-- Your app content -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onLaunch() {
|
||||
console.log('App Launch')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import 'uview-pro/index.scss';
|
||||
</style>
|
||||
```
|
||||
Reference in New Issue
Block a user