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,150 @@
|
||||
# Basic UniAppX Project Template | 基础 UniAppX 项目模板
|
||||
|
||||
## Instructions
|
||||
|
||||
This template provides a basic UniAppX project structure with uView Pro integration.
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
uniappx-uview-pro-project/
|
||||
├── uni_modules/
|
||||
│ └── uview-pro/
|
||||
├── pages/
|
||||
│ ├── index/
|
||||
│ │ └── index.vue
|
||||
│ └── detail/
|
||||
│ └── detail.vue
|
||||
├── components/
|
||||
├── static/
|
||||
├── App.vue
|
||||
├── main.uts
|
||||
├── pages.json
|
||||
├── manifest.json
|
||||
└── uni.scss
|
||||
```
|
||||
|
||||
### main.uts
|
||||
|
||||
```typescript
|
||||
// main.uts
|
||||
import { createSSRApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import uViewPro from 'uview-pro'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(uViewPro)
|
||||
return {
|
||||
app
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### App.vue
|
||||
|
||||
```vue
|
||||
<!-- App.vue -->
|
||||
<template>
|
||||
<view id="app">
|
||||
<!-- App root -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// App setup
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/* Import uView Pro styles */
|
||||
@import "uview-pro/index.scss";
|
||||
</style>
|
||||
```
|
||||
|
||||
### pages.json
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
}
|
||||
],
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-pro/components/u-$1/u-$1.vue"
|
||||
}
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "UniAppX uView Pro",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### manifest.json
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "uniappx-uview-pro-demo",
|
||||
"appid": "__UNI__XXXXX",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"h5": {
|
||||
"router": {
|
||||
"mode": "hash"
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"appid": "",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents": true
|
||||
},
|
||||
"app-plus": {
|
||||
"usingComponents": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### pages/index/index.vue
|
||||
|
||||
```vue
|
||||
<!-- pages/index/index.vue -->
|
||||
<template>
|
||||
<view class="container">
|
||||
<u-button type="primary" @click="handleClick">按钮</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const handleClick = () => {
|
||||
uni.showToast({
|
||||
title: '点击成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Use TypeScript (.uts files) for main entry
|
||||
- Use Composition API and setup syntax
|
||||
- Configure easycom for automatic component import
|
||||
- Import uView Pro styles in App.vue
|
||||
- Use rpx units for responsive sizing
|
||||
@@ -0,0 +1,91 @@
|
||||
# Manifest Configuration Template | Manifest 配置模板
|
||||
|
||||
## Instructions
|
||||
|
||||
This template provides manifest.json configuration for UniAppX projects with uView Pro.
|
||||
|
||||
### Basic Template
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "uniappx-uview-pro-demo",
|
||||
"appid": "__UNI__XXXXX",
|
||||
"description": "UniAppX uView Pro Demo",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"h5": {
|
||||
"router": {
|
||||
"mode": "hash"
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"appid": "",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents": true
|
||||
},
|
||||
"app-plus": {
|
||||
"usingComponents": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Complete Template
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "uniappx-uview-pro-demo",
|
||||
"appid": "__UNI__XXXXX",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"h5": {
|
||||
"devServer": {
|
||||
"port": 8080
|
||||
},
|
||||
"router": {
|
||||
"mode": "hash",
|
||||
"base": "/"
|
||||
},
|
||||
"optimization": {
|
||||
"treeShaking": {
|
||||
"enable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"appid": "your-appid",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"enhance": true,
|
||||
"postcss": true,
|
||||
"minified": true
|
||||
},
|
||||
"usingComponents": true
|
||||
},
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"distribute": {
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.INTERNET\"/>"
|
||||
]
|
||||
},
|
||||
"ios": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Configure `usingComponents: true` for mini-program and App
|
||||
- Set platform-specific settings
|
||||
- Configure build options
|
||||
- Use `transformPx: false` to avoid unit conversion issues
|
||||
- Test configuration on each platform
|
||||
@@ -0,0 +1,87 @@
|
||||
# Pages Configuration Template | Pages 配置模板
|
||||
|
||||
## Instructions
|
||||
|
||||
This template provides pages.json configuration for UniAppX projects with uView Pro.
|
||||
|
||||
### Basic Template
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
}
|
||||
],
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-pro/components/u-$1/u-$1.vue"
|
||||
}
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "UniAppX uView Pro",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### With Tab Bar
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/user",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#7A7E83",
|
||||
"selectedColor": "#3cc51f",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "static/tab-home.png",
|
||||
"selectedIconPath": "static/tab-home-current.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/user",
|
||||
"iconPath": "static/tab-user.png",
|
||||
"selectedIconPath": "static/tab-user-current.png",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^u-(.*)": "uview-pro/components/u-$1/u-$1.vue"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Key Points
|
||||
|
||||
- Configure pages array with all pages
|
||||
- Set up easycom for automatic uView Pro component import
|
||||
- Configure navigation bar titles
|
||||
- Use tabBar for bottom navigation
|
||||
- Configure global styles
|
||||
Reference in New Issue
Block a user