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,167 @@
|
||||
# Configuration API
|
||||
|
||||
## 配置 API
|
||||
|
||||
UniApp + uCharts 项目的配置文件 API 参考。
|
||||
|
||||
### pages.json 配置
|
||||
|
||||
#### easycom 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### pages 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"navigationStyle": "default" | "custom",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black" | "white",
|
||||
"backgroundColor": "#f5f5f5",
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### globalStyle 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black" | "white",
|
||||
"navigationBarTitleText": "UniApp",
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"backgroundColor": "#f5f5f5"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### manifest.json 配置
|
||||
|
||||
#### 基本配置
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "uniapp-ucharts-project",
|
||||
"appid": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false
|
||||
}
|
||||
```
|
||||
|
||||
#### H5 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"h5": {
|
||||
"router": {
|
||||
"mode": "hash" | "history",
|
||||
"base": "/"
|
||||
},
|
||||
"devServer": {
|
||||
"https": false,
|
||||
"port": 8080
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 微信小程序配置
|
||||
|
||||
```json
|
||||
{
|
||||
"mp-weixin": {
|
||||
"appid": "your-appid",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"enhance": true,
|
||||
"postcss": true,
|
||||
"minified": true
|
||||
},
|
||||
"usingComponents": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### App 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"distribute": {
|
||||
"android": {
|
||||
"permissions": []
|
||||
},
|
||||
"ios": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### uni.scss 配置
|
||||
|
||||
```scss
|
||||
/* uni.scss */
|
||||
/* 自定义变量 */
|
||||
$uni-color-primary: #409EFF;
|
||||
$uni-bg-color: #f5f5f5;
|
||||
```
|
||||
|
||||
### App.vue 配置
|
||||
|
||||
```vue
|
||||
<style lang="scss">
|
||||
/* 全局样式 */
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
|
||||
### main.js 配置
|
||||
|
||||
#### Vue 2
|
||||
|
||||
```javascript
|
||||
import App from './App'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
```
|
||||
|
||||
#### Vue 3
|
||||
|
||||
```javascript
|
||||
import { createSSRApp } from 'vue'
|
||||
import App from './App'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
return { app }
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,153 @@
|
||||
# Integration API
|
||||
|
||||
## UniApp 与 uCharts 整合 API
|
||||
|
||||
UniApp 与 uCharts 整合使用的 API 参考。
|
||||
|
||||
### easycom 配置 API
|
||||
|
||||
```json
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": boolean,
|
||||
"custom": {
|
||||
"qiun-data-charts": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### pages.json API
|
||||
|
||||
```json
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "string",
|
||||
"style": {
|
||||
"navigationBarTitleText": "string",
|
||||
"navigationStyle": "default" | "custom",
|
||||
"navigationBarBackgroundColor": "string",
|
||||
"navigationBarTextStyle": "black" | "white",
|
||||
"enablePullDownRefresh": boolean,
|
||||
"onReachBottomDistance": number
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black" | "white",
|
||||
"navigationBarTitleText": "string",
|
||||
"navigationBarBackgroundColor": "string",
|
||||
"backgroundColor": "string"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### manifest.json API
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "string",
|
||||
"appid": "string",
|
||||
"versionName": "string",
|
||||
"versionCode": "string",
|
||||
"transformPx": boolean,
|
||||
"app-plus": {
|
||||
"usingComponents": boolean,
|
||||
"nvueStyleCompiler": "uni-app" | "weex"
|
||||
},
|
||||
"h5": {
|
||||
"router": {
|
||||
"mode": "hash" | "history",
|
||||
"base": "string"
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"appid": "string",
|
||||
"setting": {
|
||||
"urlCheck": boolean,
|
||||
"es6": boolean,
|
||||
"enhance": boolean,
|
||||
"postcss": boolean,
|
||||
"minified": boolean
|
||||
},
|
||||
"usingComponents": boolean
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### UniApp API 与 uCharts 配合
|
||||
|
||||
#### 导航 API
|
||||
|
||||
```javascript
|
||||
// 页面跳转
|
||||
uni.navigateTo({
|
||||
url: 'string',
|
||||
success: function,
|
||||
fail: function,
|
||||
complete: function
|
||||
})
|
||||
|
||||
// 页面返回
|
||||
uni.navigateBack({
|
||||
delta: number
|
||||
})
|
||||
```
|
||||
|
||||
#### 网络请求 API
|
||||
|
||||
```javascript
|
||||
uni.request({
|
||||
url: 'string',
|
||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE',
|
||||
data: object,
|
||||
header: object,
|
||||
success: function,
|
||||
fail: function,
|
||||
complete: function
|
||||
})
|
||||
```
|
||||
|
||||
#### 存储 API
|
||||
|
||||
```javascript
|
||||
// 存储数据
|
||||
uni.setStorage({
|
||||
key: 'string',
|
||||
data: any,
|
||||
success: function,
|
||||
fail: function
|
||||
})
|
||||
|
||||
// 获取数据
|
||||
uni.getStorage({
|
||||
key: 'string',
|
||||
success: function,
|
||||
fail: function
|
||||
})
|
||||
```
|
||||
|
||||
### 条件编译 API
|
||||
|
||||
```javascript
|
||||
// #ifdef 平台名称
|
||||
// 平台特定代码
|
||||
// #endif
|
||||
|
||||
// #ifndef 平台名称
|
||||
// 非平台特定代码
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
// H5 平台代码
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序代码
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// App 平台代码
|
||||
// #endif
|
||||
```
|
||||
Reference in New Issue
Block a user