1
0
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:
小莫唐尼
2026-08-31 07:58:23 +08:00
commit ba5b77568b
693 changed files with 118430 additions and 0 deletions
@@ -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>
```