Commit 55786551 by Jaxon

feat: 新增 uniapp demo项目

1 parent 4c34ae77
Showing 211 changed files with 4021 additions and 0 deletions
---
name: Bug report(报告问题)
about: Create a report to help us improve
---
<!--
注意:为更好的解决你的问题,请参考模板提供完整信息,准确描述问题,信息不全的 issue 将被关闭。
Note: In order to better solve your problem, please refer to the template to provide complete information, accurately describe the problem, and the incomplete information issue will be closed.
-->
# Bug report(问题描述)
please write your issue description here
## Steps to reproduce(问题复现步骤)
<!--
1. [xxx]
2. [xxx]
3. [xxxx]
-->
## Screenshot or Gif(截图或动态图)
## minimal reproduction(最小可还原代码)
## System Info
`npx envinfo --system --npmPackages vue --binaries --browsers`
执行上面命令,将结果贴下面
---
name: Feature Request(新功能建议)
about: Suggest an idea for this project
---
# Feature request(新功能建议)
name: Deploy Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --no-frozen-lockfile
- name: Build
run: pnpm build:h5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist/build/h5
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
node_modules*
.DS_Store
dist
*.local
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.hbuilderx
.stylelintcache
# rollup-plugin-visualizer 生成的分析文件
stats.html
# unplugin-auto-import 生成的类型文件
# auto-import.d.ts
# unplugin-vue-components 生成的类型文件
# components.d.ts
# vite-plugin-uni-pages 生成的类型文件
# uni-pages.d.ts
# 插件生成的文件
# src/pages.json
# src/manifest.json
# lock 文件还是不要了,我主要的版本写死就好了
# github actions 需要这些文件,所以main分支需要留着
# pnpm-lock.yaml
# package-lock.json
# TIPS:如果某些文件已经加入了版本管理,现在重新加入 .gitignore 是不生效的,需要执行下面的操作
# `git rm -r --cached .` 然后提交 commit 即可。
# git rm -r --cached file1 file2 ## 针对某些文件
# git rm -r --cached dir1 dir2 ## 针对某些文件夹
# git rm -r --cached . ## 针对所有文件
# 要跳过检查时,使用 --no-verify 过滤
# git commit -m 'feat: 引入 ucharts' --no-verify
# npx @dcloudio/uvm@latest 更新 uniapp
# registry = https://registry.npmjs.org
registry = https://registry.npmmirror.com
strict-peer-dependencies=false
auto-install-peers=true
shamefully-hoist=true
MIT License
Copyright (c) 2024 菲鸽
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<p align="center">
<a href="https://github.com/feige996/unibest">
<img width="160" src="./src/static/logo.svg">
</a>
</p>
<h1 align="center">
<a href="https://github.com/feige996/unibest" target="_blank">unibest - 最好的 uniapp 开发框架</a>
</h1>
<div align="center">
旧仓库 codercup 进不去了,star 也拿不回来,这里也展示一下那个地址的 star.
[![GitHub Repo stars](https://img.shields.io/github/stars/codercup/unibest?style=flat&logo=github)](https://github.com/codercup/unibest)
[![GitHub forks](https://img.shields.io/github/forks/codercup/unibest?style=flat&logo=github)](https://github.com/codercup/unibest)
</div>
<div align="center">
[![GitHub Repo stars](https://img.shields.io/github/stars/feige996/unibest?style=flat&logo=github)](https://github.com/feige996/unibest)
[![GitHub forks](https://img.shields.io/github/forks/feige996/unibest?style=flat&logo=github)](https://github.com/feige996/unibest)
[![star](https://gitee.com/feige996/unibest/badge/star.svg?theme=dark)](https://gitee.com/feige996/unibest/stargazers)
[![fork](https://gitee.com/feige996/unibest/badge/fork.svg?theme=dark)](https://gitee.com/feige996/unibest/members)
![node version](https://img.shields.io/badge/node-%3E%3D18-green)
![pnpm version](https://img.shields.io/badge/pnpm-%3E%3D7.30-green)
![GitHub package.json version (subfolder of monorepo)](https://img.shields.io/github/package-json/v/feige996/unibest)
![GitHub License](https://img.shields.io/github/license/feige996/unibest)
</div>
`unibest` —— 最好的 `uniapp` 开发模板,由 `uniapp` + `Vue3` + `Ts` + `Vite5` + `UnoCss` + `wot-ui` + `z-paging` 构成,使用了最新的前端技术栈,无需依靠 `HBuilderX`,通过命令行方式运行 `web`、`小程序` 和 `App`(编辑器推荐 `VSCode`,可选 `webstorm`)。
`unibest` 内置了 `约定式路由`、`layout布局`、`请求封装`、`请求拦截`、`登录拦截`、`UnoCSS`、`i18n多语言` 等基础功能,提供了 `代码提示`、`自动格式化`、`统一配置`、`代码片段` 等辅助功能,让你编写 `uniapp` 拥有 `best` 体验 ( `unibest 的由来`)。
![](https://raw.githubusercontent.com/andreasbm/readme/master/screenshots/lines/rainbow.png)
<p align="center">
<a href="https://unibest.tech/" target="_blank">📖 文档地址</a>
<span style="margin:0 10px;">|</span>
<a href="https://feige996.github.io/hello-unibest/" target="_blank">📱 DEMO 地址</a>
</p>
---
注意旧的地址 [codercup](https://github.com/codercup/unibest) 我进不去了,使用新的 [feige996](https://github.com/feige996/unibest)。PR和 issue 也请使用新地址,否则无法合并。
## ⚙️ 环境
- node>=18
- pnpm>=7.30
- Vue Official>=2.1.10
- TypeScript>=5.0
## &#x1F4C2; 快速开始
执行 `pnpm create unibest` 创建项目
执行 `pnpm i` 安装依赖
执行 `pnpm dev` 运行 `H5`
## 📦 运行(支持热更新)
- web平台: `pnpm dev:h5`, 然后打开 [http://localhost:9000/](http://localhost:9000/)。
- weixin平台:`pnpm dev:mp-weixin` 然后打开微信开发者工具,导入本地文件夹,选择本项目的`dist/dev/mp-weixin` 文件。
- APP平台:`pnpm dev:app`, 然后打开 `HBuilderX`,导入刚刚生成的`dist/dev/app` 文件夹,选择运行到模拟器(开发时优先使用),或者运行的安卓/ios基座。
## 🔗 发布
- web平台: `pnpm build:h5`,打包后的文件在 `dist/build/h5`,可以放到web服务器,如nginx运行。如果最终不是放在根目录,可以在 `manifest.config.ts` 文件的 `h5.router.base` 属性进行修改。
- weixin平台:`pnpm build:mp-weixin`, 打包后的文件在 `dist/build/mp-weixin`,然后通过微信开发者工具导入,并点击右上角的“上传”按钮进行上传。
- APP平台:`pnpm build:app`, 然后打开 `HBuilderX`,导入刚刚生成的`dist/build/app` 文件夹,选择发行 - APP云打包。
## 📄 License
[MIT](https://opensource.org/license/mit/)
Copyright (c) 2024 菲鸽
## 捐赠
<p align='center'>
<img alt="special sponsor appwrite" src="./screenshots/pay-1.png" height="330" style="display:inline-block; height:330px;">
<img alt="special sponsor appwrite" src="./screenshots/pay-2.png" height="330" style="display:inline-block; height:330px; margin-left:10px;">
</p>
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by vite-plugin-uni-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
AppTest: typeof import('./src/components/AppTest.vue')['default']
AppTest2: typeof import('./src/components/app-test-dir/AppTest2.vue')['default']
FlyContent: typeof import('./src/components/fly-content/fly-content.vue')['default']
FlyHeader: typeof import('./src/components/fly-header/fly-header.vue')['default']
FlyLogin: typeof import('./src/components/fly-login/fly-login.vue')['default']
FlyNavbar: typeof import('./src/components/fly-navbar/fly-navbar.vue')['default']
SvgIcon: typeof import('./src/components/SvgIcon.vue')['default']
}
}
VITE_APP_TITLE = 'unibest'
VITE_APP_PORT = 9000
# github actions 部署地址根路径,用在 manifest.config.ts 里面的 h5.router.base
VITE_APP_PUBLIC_BASE=/hello-unibest/
# TODO: 记得修改
VITE_UNI_APPID = 'H5871D791'
VITE_WX_APPID = 'wxa2abb91f64032a2b'
# fallback lacale:en, zh-Hans, zh-Hant 等
# 必须要在 lacale 文件夹中配置对应的 json 文件!!!
# 参考文档如下
# https://uniapp.dcloud.net.cn/tutorial/i18n.html
# https://uniapp.dcloud.net.cn/api/ui/locale.html#onlocalechange 打开页面后最下面的注意事项
VITE_FALLBACK_LOCALE = 'zh-Hans'
VITE_SERVER_BASEURL = 'https://ukw0y1.laf.run'
VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload'
VITE_ENV_FILE = '.env'
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development'
# 是否去除console 和 debugger
VITE_DELETE_CONSOLE = false
# VITE_SERVER_BASEURL = 'https://ukw0y1.laf.run'
VITE_ENV_FILE = '.env.development'
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development'
# 是否去除console 和 debugger
VITE_DELETE_CONSOLE = true
# VITE_SERVER_BASEURL = 'https://xxx.com'
VITE_ENV_FILE = '.env.production'
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development'
# 是否去除console 和 debugger
VITE_DELETE_CONSOLE = false
# VITE_SERVER_BASEURL = 'https://xxx.com'
VITE_ENV_FILE = '.env.test'
No preview for this file type
<!doctype html>
<html build-date="%BUILD_DATE%">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script>
var coverSupport =
'CSS' in window &&
typeof CSS.supports === 'function' &&
(CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') +
'" />',
)
</script>
<title>unibest</title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
// manifest.config.ts
import { defineManifestConfig } from '@uni-helper/vite-plugin-uni-manifest'
import path from 'node:path'
import { loadEnv } from 'vite'
// 获取环境变量的范例
const env = loadEnv(process.env.NODE_ENV!, path.resolve(process.cwd(), 'env'))
// console.log('manifest.config.ts')
// console.log(env)
const {
VITE_APP_TITLE,
VITE_UNI_APPID,
VITE_WX_APPID,
VITE_APP_PUBLIC_BASE,
VITE_FALLBACK_LOCALE,
} = env
export default defineManifestConfig({
name: VITE_APP_TITLE,
appid: VITE_UNI_APPID,
description: '',
versionName: '1.0.0',
versionCode: '100',
transformPx: false,
locale: VITE_FALLBACK_LOCALE, // 'zh-Hans'
h5: {
router: {
base: VITE_APP_PUBLIC_BASE,
},
},
/* 5+App特有相关 */
'app-plus': {
usingComponents: true,
nvueStyleCompiler: 'uni-app',
compilerVersion: 3,
splashscreen: {
alwaysShowBeforeRender: true,
waiting: true,
autoclose: true,
delay: 0,
},
/* 模块配置 */
modules: {},
/* 应用发布信息 */
distribute: {
/* android打包配置 */
android: {
minSdkVersion: 30,
targetSdkVersion: 30,
abiFilters: ['armeabi-v7a', 'arm64-v8a'],
permissions: [
'<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>',
'<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>',
'<uses-permission android:name="android.permission.VIBRATE"/>',
'<uses-permission android:name="android.permission.READ_LOGS"/>',
'<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>',
'<uses-feature android:name="android.hardware.camera.autofocus"/>',
'<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>',
'<uses-permission android:name="android.permission.CAMERA"/>',
'<uses-permission android:name="android.permission.GET_ACCOUNTS"/>',
'<uses-permission android:name="android.permission.READ_PHONE_STATE"/>',
'<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>',
'<uses-permission android:name="android.permission.WAKE_LOCK"/>',
'<uses-permission android:name="android.permission.FLASHLIGHT"/>',
'<uses-feature android:name="android.hardware.camera"/>',
'<uses-permission android:name="android.permission.WRITE_SETTINGS"/>',
],
},
/* ios打包配置 */
ios: {},
/* SDK配置 */
sdkConfigs: {},
/* 图标配置 */
icons: {
android: {},
ios: {},
},
},
},
/* 快应用特有相关 */
quickapp: {},
/* 小程序特有相关 */
'mp-weixin': {
appid: VITE_WX_APPID,
setting: {
urlCheck: false,
},
usingComponents: true,
// __usePrivacyCheck__: true,
},
'mp-alipay': {
usingComponents: true,
},
'mp-baidu': {
usingComponents: true,
},
'mp-toutiao': {
usingComponents: true,
},
uniStatistics: {
enable: false,
},
vueVersion: '3',
})
import { createProdMockServer } from 'vite-plugin-mock/client'
const modules = import.meta.glob('/mock/**/*.ts', { eager: true })
const mockModules: any[] = []
Object.keys(modules).forEach((key) => {
if (key.includes('/_')) {
return
}
mockModules.push(...(modules as Recordable)[key].default)
})
console.log('mockModules -> ', mockModules)
/**
* Used in a production environment. Need to manually import all modules
*/
export function setupProdMockServer() {
createProdMockServer(mockModules)
}
// test.ts
import { MockMethod, MockConfig } from 'vite-plugin-mock'
export default [
{
url: '/api/get',
method: 'get',
response: ({ query }) => {
return {
code: 0,
data: {
name: '菲鸽',
},
}
},
},
{
url: '/api/post',
method: 'post',
timeout: 2000,
response: {
code: 0,
data: {
name: '菲鸽',
},
},
},
{
url: '/api/text',
method: 'post',
rawResponse: async (req, res) => {
let reqbody = ''
await new Promise((resolve) => {
req.on('data', (chunk) => {
reqbody += chunk
})
req.on('end', () => resolve(undefined))
})
res.setHeader('Content-Type', 'text/plain')
res.statusCode = 200
res.end(`hello, ${reqbody}`)
},
},
] as MockMethod[]
{
"name": "unibest",
"type": "commonjs",
"version": "1.5.0",
"description": "unibest - 最好的 uniapp 开发模板",
"author": {
"name": "feige996",
"zhName": "菲鸽",
"email": "1020103647@qq.com",
"github": "https://github.com/feige996",
"gitee": "https://gitee.com/feige996"
},
"license": "MIT",
"repository": "https://github.com/feige996/unibest",
"repository-gitee": "https://gitee.com/feige996/unibest",
"bugs": {
"url": "https://github.com/feige996/unibest/issues"
},
"homepage": "https://feige996.github.io/hello-unibest/",
"engines": {
"node": ">=18",
"pnpm": ">=7.30"
},
"scripts": {
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:custom": "uni -p",
"dev": "uni",
"dev-dev": "uni --mode development",
"dev-test": "uni --mode test",
"dev-prod": "uni --mode production",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp": "uni -p mp-weixin",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-jd": "uni -p mp-jd",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp": "uni build -p mp-weixin",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-jd": "uni build -p mp-jd",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"prepare": "node ./shell/postinstall.js & git init && husky install ",
"type-check": "vue-tsc --noEmit"
},
"lint-staged": {
"**/*.{html,vue,ts,cjs,json,md}": [
"prettier --write"
],
"**/*.{vue,js,ts,jsx,tsx}": [
"eslint --fix"
],
"**/*.{vue,css,scss,html}": [
"stylelint --fix --allow-empty-input"
]
},
"resolutions": {
"bin-wrapper": "npm:bin-wrapper-china"
},
"dependencies": {
"@climblee/uv-ui": "^1.1.20",
"@dcloudio/uni-app": "3.0.0-4000820240401001",
"@dcloudio/uni-app-plus": "3.0.0-4000820240401001",
"@dcloudio/uni-components": "3.0.0-4000820240401001",
"@dcloudio/uni-h5": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-alipay": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-baidu": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-jd": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-lark": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-qq": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-toutiao": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-weixin": "3.0.0-4000820240401001",
"@dcloudio/uni-mp-xhs": "3.0.0-4000820240401001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4000820240401001",
"@dcloudio/uni-ui": "1.5.0",
"dayjs": "1.11.10",
"echarts": "^5.6.0",
"lodash-es": "^4.17.21",
"pinia": "2.0.36",
"pinia-plugin-persistedstate": "3.2.1",
"qs": "6.5.3",
"vue": "3.3.11",
"vue-i18n": "^9.10.2",
"wot-design-uni": "^1.9.1",
"z-paging": "^2.7.8"
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@dcloudio/types": "^3.4.8",
"@dcloudio/uni-automator": "3.0.0-4000820240401001",
"@dcloudio/uni-cli-shared": "3.0.0-4000820240401001",
"@dcloudio/uni-stacktracey": "3.0.0-4000820240401001",
"@dcloudio/vite-plugin-uni": "3.0.0-4000820240401001",
"@iconify-json/carbon": "^1.1.27",
"@ttou/uv-typings": "^1.10.2",
"@types/node": "^20.11.5",
"@types/wechat-miniprogram": "^3.4.7",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@uni-helper/uni-ui-types": "^0.5.11",
"@uni-helper/vite-plugin-uni-components": "^0.0.8",
"@uni-helper/vite-plugin-uni-layouts": "^0.1.7",
"@uni-helper/vite-plugin-uni-manifest": "^0.2.3",
"@uni-helper/vite-plugin-uni-pages": "^0.2.15",
"@uni-helper/vite-plugin-uni-platform": "^0.0.4",
"@unocss/preset-legacy-compat": "0.58.9",
"@vue/runtime-core": "^3.3.13",
"@vue/tsconfig": "^0.1.3",
"autoprefixer": "^10.4.16",
"commitlint": "^18.4.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.0",
"eslint-plugin-vue": "^9.19.2",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"postcss": "^8.4.32",
"postcss-html": "^1.5.0",
"postcss-scss": "^4.0.9",
"rollup-plugin-visualizer": "^5.11.0",
"sass": "1.77.8",
"stylelint": "^16.0.2",
"stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^4.4.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard": "^35.0.0",
"stylelint-config-standard-scss": "^12.0.0",
"stylelint-prettier": "^5.0.0",
"terser": "^5.26.0",
"typescript": "^4.9.4",
"unocss": "^0.58.9",
"unocss-applet": "^0.7.8",
"unplugin-auto-import": "^0.17.2",
"vite": "4.3.5",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-mock": "^3.0.1",
"vite-plugin-restart": "^0.4.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vite-svg-loader": "^5.1.0",
"vue-tsc": "^1.8.25"
}
}
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
export default defineUniPages({
globalStyle: {
navigationStyle: 'default',
navigationBarTitleText: 'unibest',
navigationBarBackgroundColor: '#f8f8f8',
navigationBarTextStyle: 'black',
backgroundColor: '#FFFFFF',
h5: {
// navigationStyle: 'custom',
},
},
easycom: {
autoscan: true,
custom: {
'^uni-(.*)': '@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue',
'^uv-(.*)': '@climblee/uv-ui/components/uv-$1/uv-$1.vue',
'^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue',
'^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)':
'z-paging/components/z-paging$1/z-paging$1.vue',
},
},
tabBar: {
color: '#999999',
selectedColor: '#018d71',
backgroundColor: '#F8F8F8',
borderStyle: 'black',
height: '50px',
fontSize: '10px',
iconWidth: '24px',
spacing: '3px',
list: [
{
iconPath: 'static/tabbar/home.png',
selectedIconPath: 'static/tabbar/homeHL.png',
pagePath: 'pages/index/index',
text: '首页',
},
{
iconPath: 'static/tabbar/example.png',
selectedIconPath: 'static/tabbar/exampleHL.png',
pagePath: 'pages/demo/index',
text: '示例',
},
],
},
})
This diff could not be displayed because it is too large.
/**
* 本文件会在依赖包安装时执行,用以生成 `src/manifest.json`
* 如果不存在 `src/manifest.json` 会运行报错,提示找不到 `src/manifest.json`
* 如果中途自己删除了 'src/manifest.json' 文件,记得手动执行本文件,可以右键 `Run Code` 快速执行
*
* 本文件是为了兼容 window 系统才生成的
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require('fs')
const filePath = './src/manifest.json'
if (fs.existsSync(filePath)) {
// console.log(`${filePath}存在`)
} else {
// console.log(`${filePath}不存在,需要创建`)
fs.writeFile(filePath, '{}\n', {}, () => {
// console.log(`${filePath}已经成功创建,并写入{}`)
})
}
# 本文件会在依赖包安装时执行,用以生成 `src/manifest.json`
# 如果不存在 `src/manifest.json` 会运行报错,提示找不到 `src/manifest.json`
# 如果中途自己删除了 'src/manifest.json' 文件,记得手动执行本文件,可以右键 `Run Code` 快速执行
if test -f ./src/manifest.json; then
echo ./src/manifest.json 存在
else
touch ./src/manifest.json
echo "{}" >./src/manifest.json
fi
# pnpm build:app 之后会生成 unpackage/dist/build/app
# 我要把它改名为 unpackage/dist/build/unibest_app_build
# 只有存在新的 app 文件时,才执行这些操作!!否则会误删!!
if test -d ./dist/build/app; then
echo '存在新打包出来的app - build'
cd ./dist/build/
# 1、删除旧的 rename 后的文件夹
if test -d './unibest_app_build'; then
rm -rf ./unibest_app_build
fi
# 2、把 app 命名为 unibest_app_build
mv ./app ./unibest_app_build
fi
if test -d ./dist/dev/app; then
echo '存在新打包出来的app - dev'
cd ./dist/dev/
# 1、删除旧的 rename 后的文件夹
if test -d './unibest_app_dev'; then
rm -rf ./unibest_app_dev
fi
# 2、把 app 命名为 unibest_app_build
mv ./app ./unibest_app_dev
fi
/// <reference types='@dcloudio/types' />
import 'vue'
declare module '@vue/runtime-core' {
type Hooks = App.AppInstance & Page.PageInstance
interface ComponentCustomOptions extends Hooks {}
}
<script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
onLaunch(() => {
console.log('App Launch')
})
onShow(() => {
console.log('App Show')
})
onHide(() => {
console.log('App Hide')
})
</script>
<style lang="scss">
/* stylelint-disable selector-type-no-unknown */
button::after {
border: none;
}
swiper,
scroll-view {
flex: 1;
height: 100%;
overflow: hidden;
}
image {
width: 100%;
height: 100%;
vertical-align: middle;
}
// 单行省略,优先使用 unocss: text-ellipsis
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// 两行省略
.ellipsis-2 {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
// 三行省略
.ellipsis-3 {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
</style>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1712309809495" class="icon" viewBox="0 0 1049 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4978" xmlns:xlink="http://www.w3.org/1999/xlink" width="65.5625" height="64"><path d="M161.4336 0h624.1024c107.6224 0 161.4336 53.6832 161.4336 161.0752v687.7696c0 107.392-53.8112 161.0752-161.4336 161.0752H161.4336C53.8112 1009.92 0 956.2368 0 848.8448V161.0752C0 53.6832 53.8112 0 161.4336 0z" fill="#01B26A" p-id="4979"></path><path d="M672.1792 352.1024H181.632c-26.88 0-48.64-21.7088-48.64-48.512 0-26.8288 21.76-48.5376 48.64-48.5376h490.5472c26.88 0 48.64 21.7088 48.64 48.5376 0 26.8032-21.76 48.512-48.64 48.512zM485.888 627.84H181.8624c-26.88 0-48.64-21.7344-48.64-48.5376s21.76-48.5376 48.64-48.5376H485.888c26.88 0 48.64 21.76 48.64 48.5376 0 26.8032-21.76 48.5376-48.64 48.5376z" fill="#FFFFFF" p-id="4980"></path><path d="M523.264 761.4208C523.264 906.4448 641.1264 1024 786.432 1024 931.7888 1024 1049.6 906.4448 1049.6 761.4208c0-144.9984-117.8112-262.5536-263.168-262.5536-145.3312 0-263.168 117.5552-263.168 262.5536z" fill="#28D493" fill-opacity=".517" p-id="4981"></path><path d="M786.432 498.944c-128.768-0.1792-238.72 92.6976-259.84 219.4432a262.4512 262.4512 0 0 0 174.72 291.5328h84.0448c89.088 0.1024 161.4336-71.8592 161.6128-160.768V553.5232a261.8368 261.8368 0 0 0-160.512-54.6048z" fill="#00AA69" p-id="4982"></path><path d="M724.0448 918.272a48.64 48.64 0 0 1-44.0832-28.1088 48.4352 48.4352 0 0 1 6.9376-51.7376l71.1936-84.0192v-115.8144c0-26.8032 21.7856-48.5376 48.64-48.5376 26.88 0 48.64 21.7344 48.64 48.5376v133.4528c0 11.4688-4.0704 22.5536-11.4688 31.3088l-82.688 97.6128c-9.216 10.9312-22.8352 17.28-37.1712 17.28z" fill="#FFFFFF" p-id="4983"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1712309809495" class="icon" viewBox="0 0 1049 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4978" xmlns:xlink="http://www.w3.org/1999/xlink" width="65.5625" height="64"><path d="M161.4336 0h624.1024c107.6224 0 161.4336 53.6832 161.4336 161.0752v687.7696c0 107.392-53.8112 161.0752-161.4336 161.0752H161.4336C53.8112 1009.92 0 956.2368 0 848.8448V161.0752C0 53.6832 53.8112 0 161.4336 0z" fill="#01B26A" p-id="4979"></path><path d="M672.1792 352.1024H181.632c-26.88 0-48.64-21.7088-48.64-48.512 0-26.8288 21.76-48.5376 48.64-48.5376h490.5472c26.88 0 48.64 21.7088 48.64 48.5376 0 26.8032-21.76 48.512-48.64 48.512zM485.888 627.84H181.8624c-26.88 0-48.64-21.7344-48.64-48.5376s21.76-48.5376 48.64-48.5376H485.888c26.88 0 48.64 21.76 48.64 48.5376 0 26.8032-21.76 48.5376-48.64 48.5376z" fill="#FFFFFF" p-id="4980"></path><path d="M523.264 761.4208C523.264 906.4448 641.1264 1024 786.432 1024 931.7888 1024 1049.6 906.4448 1049.6 761.4208c0-144.9984-117.8112-262.5536-263.168-262.5536-145.3312 0-263.168 117.5552-263.168 262.5536z" fill="#28D493" fill-opacity=".517" p-id="4981"></path><path d="M786.432 498.944c-128.768-0.1792-238.72 92.6976-259.84 219.4432a262.4512 262.4512 0 0 0 174.72 291.5328h84.0448c89.088 0.1024 161.4336-71.8592 161.6128-160.768V553.5232a261.8368 261.8368 0 0 0-160.512-54.6048z" fill="#00AA69" p-id="4982"></path><path d="M724.0448 918.272a48.64 48.64 0 0 1-44.0832-28.1088 48.4352 48.4352 0 0 1 6.9376-51.7376l71.1936-84.0192v-115.8144c0-26.8032 21.7856-48.5376 48.64-48.5376 26.88 0 48.64 21.7344 48.64 48.5376v133.4528c0 11.4688-4.0704 22.5536-11.4688 31.3088l-82.688 97.6128c-9.216 10.9312-22.8352 17.28-37.1712 17.28z" fill="#FFFFFF" p-id="4983"></path></svg>
\ No newline at end of file
<!-- 本文件会自动导入 -->
<template>
<view>
<view>components 里面的 AppTest.vue 组件</view>
<slot />
</view>
</template>
<template>
<svg aria-hidden="true">
<use :href="symbolId" :fill="color" />
</svg>
</template>
<script lang="ts" setup name="SvgIcon">
const props = withDefaults(
defineProps<{
prefix?: string
name: string
color?: string
}>(),
{
prefix: 'icon',
name: '',
color: '#333',
},
)
const symbolId = computed(() => `#${props.prefix}-${props.name}`)
</script>
<template>
<view>
<view>components 里面的 app-test-dir/AppTest.vue 组件</view>
<slot />
</view>
</template>
<template>
<view class="fly-content">
<view v-for="n in line" :key="n" class="h-10 leading-10 text-center">
很多内容,这里是第{{ n }}行
</view>
</view>
</template>
<script lang="ts" setup>
withDefaults(defineProps<{ line?: number }>(), { line: 10 })
</script>
<template>
<view class="text-green-500">header</view>
</template>
# fly-login
点击“点击显示微信头像”按钮后,出现的半屏登录弹窗,可以在任意页面引入。
仿“掘金小册”小程序。
![掘金小册登录](screenshot.png)
<template>
<view class="fly-login" v-if="modelValue">
<view class="fly-login-mask" />
<view class="fly-login-content px-4">
<view class="font-bold h-16 leading-16">获取您的昵称、头像</view>
<view
class="rounded-full bg-light-600 w-6 h-6 text-center absolute top-4 right-4"
@click="onClose"
>
<view class="i-carbon-close text-gray-700" />
</view>
<view
class="flex items-center h-16 leading-16 border-b-gray-400 border-b-solid border-[1rpx]"
>
<text class="mr-4 flex-shrink-0">头像</text>
<button
class="bg-transparent flex items-center after:b-none w-full h-12 leading-12"
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar"
>
<image class="w-8 h-8 rounded-full" :src="avatarUrl"></image>
<text class="ml-auto i-carbon-chevron-right"></text>
</button>
</view>
<view
class="flex items-center h-16 leading-16 border-b-gray-400 border-b-solid border-1 mt-4"
>
<text class="mr-4 flex-shrink-0">昵称</text>
<input type="nickname" placeholder="请输入昵称" @change="onChange" @blur="onChange" />
</view>
<button
size="default"
type="default"
style="color: #fff; background-color: #1aad19; border-color: #1aad19"
class="text-center leading-12 w-40 my-4"
@click="onSubmit"
>
确定
</button>
</view>
</view>
</template>
<script lang="ts" setup>
import { useUserStore } from '@/store'
import defaultAvatarUrl from './defaultAvatar.png'
const emit = defineEmits(['update:modelValue'])
defineProps<{ modelValue: boolean }>()
const userStore = useUserStore()
const avatarUrl = ref(defaultAvatarUrl)
const nickname = ref('')
const onClose = () => {
emit('update:modelValue', false)
}
const onChooseAvatar = (e) => {
const { avatarUrl: url } = e.detail
avatarUrl.value = url
// 这里就要上传,加快速度,提升体验(用户多次选择头像就多次上传吧,总有取舍)
console.log(url)
}
const onChange = (e) => {
const { value } = e.detail
nickname.value = value
console.log(value)
}
const onSubmit = () => {
// 1、上传刚刚的图片,并返回网络地址
// 2、把用户信息存起来
if (avatarUrl.value === defaultAvatarUrl) {
uni.showToast({
title: '请选择头像',
icon: 'none',
})
return
}
if (!nickname.value) {
uni.showToast({
title: '请填写昵称',
icon: 'none',
})
return
}
emit('update:modelValue', false)
console.log('保存用户信息')
userStore.setUserInfo({ nickname: nickname.value, avatar: avatarUrl.value })
}
</script>
<style lang="scss" scoped>
.fly-login {
position: fixed;
inset: 0;
.fly-login-mask {
position: fixed;
inset: 0;
background-color: rgb(0 0 0 / 30%);
}
.fly-login-content {
position: fixed;
right: 0;
bottom: var(--window-bottom);
left: 0;
background-color: #fff;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
}
}
</style>
# fly-navbar
建议本导航栏组件在设置 `"navigationStyle": "custom"` 的页面使用,目前支持微信小程序的页面滚动动画。
<template>
<!-- 自定义导航栏: 默认透明不可见, scroll-view 滚动到 50 时展示 -->
<view class="fly-navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
<!-- 1/3,多于1个页面,用返回图标 -->
<navigator v-if="pages.length > 1" open-type="navigateBack" class="left-icon">
<view class="bg-gray-500/80 rounded-full w-8 h-8 flex items-center justify-center">
<button class="i-carbon-chevron-left text-white w-7 h-7"></button>
</view>
</navigator>
<!-- 2/3,只有1个页面,如果不是tabbar,需要首页图标 -->
<!-- 这种情况一般出现在用户直接打开分享出去的详情页面,或者使用redirectTo等API -->
<navigator
v-else-if="!isTabbar"
open-type="switchTab"
url="/pages/index/index"
class="left-icon"
>
<view class="bg-gray-500/80 rounded-full w-8 h-8 flex items-center justify-center">
<button class="i-carbon-home text-white w-6 h-6"></button>
</view>
</navigator>
<!-- 3/3,如果当前页就是tabbar页,不用去首页,也就是什么图标都不需要 -->
<view class="title">{{ title || '' }}</view>
</view>
</template>
<script lang="ts" setup>
import { getIsTabbar } from '@/utils/index'
defineProps<{ title?: string }>()
// 获取页面栈
const pages = getCurrentPages()
const isTabbar = getIsTabbar()
console.log({ isTabbar, pagesLen: pages.length })
// 获取屏幕边界到安全区域距离
const { safeAreaInsets } = uni.getSystemInfoSync()
</script>
<style lang="scss" scoped>
.fly-navbar {
position: fixed;
top: 0;
left: 0;
z-index: 9;
width: 750rpx;
color: #000;
background-color: transparent;
.left-icon {
position: absolute;
left: 0;
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
font-size: 44rpx;
color: #000;
}
.title {
display: flex;
align-items: center;
justify-content: center;
height: 44px;
font-size: 32rpx;
color: transparent;
}
}
</style>
/*
* uCharts®
* 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
* 复制使用请保留本段注释,感谢支持开源!
*
* uCharts®官方网站
* https://www.uCharts.cn
*
* 开源地址:
* https://gitee.com/uCharts/uCharts
*
* uni-app插件市场地址:
* http://ext.dcloud.net.cn/plugin?id=271
*
*/
// 通用配置项
// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
const color = [
'#1890FF',
'#91CB74',
'#FAC858',
'#EE6666',
'#73C0DE',
'#3CA272',
'#FC8452',
'#9A60B4',
'#ea7ccc',
]
const cfe = {
// demotype为自定义图表类型
type: [
'pie',
'ring',
'rose',
'funnel',
'line',
'column',
'area',
'radar',
'gauge',
'candle',
'demotype',
],
// 增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
categories: ['line', 'column', 'area', 'radar', 'gauge', 'candle', 'demotype'],
// instance为实例变量承载属性,option为eopts承载属性,不要删除
instance: {},
option: {},
// 下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
formatter: {
tooltipDemo1(res) {
let result = ''
for (const i in res) {
if (i == 0) {
result += `${res[i].axisValueLabel}年销售额`
}
let value = '--'
if (res[i].data !== null) {
value = res[i].data
}
// #ifdef H5
result += `\n${res[i].seriesName}:${value} 万元`
// #endif
// #ifdef APP-PLUS
result += `<br/>${res[i].marker}${res[i].seriesName}:${value} 万元`
// #endif
}
return result
},
legendFormat(name) {
return `自定义图例+${name}`
},
yAxisFormatDemo(value, index) {
return `${value}元`
},
seriesFormatDemo(res) {
return `${res.name}年${res.value}元`
},
},
// 这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。
demotype: {
color,
// 在这里填写echarts的option即可
},
// 下面是自定义配置,请添加项目所需的通用配置
column: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'axis',
},
grid: {
top: 30,
bottom: 50,
right: 15,
left: 40,
},
legend: {
bottom: 'left',
},
toolbox: {
show: false,
},
xAxis: {
type: 'category',
axisLabel: {
color: '#666666',
},
axisLine: {
lineStyle: {
color: '#CCCCCC',
},
},
boundaryGap: true,
data: [],
},
yAxis: {
type: 'value',
axisTick: {
show: false,
},
axisLabel: {
color: '#666666',
},
axisLine: {
lineStyle: {
color: '#CCCCCC',
},
},
},
seriesTemplate: {
name: '',
type: 'bar',
data: [],
barwidth: 20,
label: {
show: true,
color: '#666666',
position: 'top',
},
},
},
line: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'axis',
},
grid: {
top: 30,
bottom: 50,
right: 15,
left: 40,
},
legend: {
bottom: 'left',
},
toolbox: {
show: false,
},
xAxis: {
type: 'category',
axisLabel: {
color: '#666666',
},
axisLine: {
lineStyle: {
color: '#CCCCCC',
},
},
boundaryGap: true,
data: [],
},
yAxis: {
type: 'value',
axisTick: {
show: false,
},
axisLabel: {
color: '#666666',
},
axisLine: {
lineStyle: {
color: '#CCCCCC',
},
},
},
seriesTemplate: {
name: '',
type: 'line',
data: [],
barwidth: 20,
label: {
show: true,
color: '#666666',
position: 'top',
},
},
},
area: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'axis',
},
grid: {
top: 30,
bottom: 50,
right: 15,
left: 40,
},
legend: {
bottom: 'left',
},
toolbox: {
show: false,
},
xAxis: {
type: 'category',
axisLabel: {
color: '#666666',
},
axisLine: {
lineStyle: {
color: '#CCCCCC',
},
},
boundaryGap: true,
data: [],
},
yAxis: {
type: 'value',
axisTick: {
show: false,
},
axisLabel: {
color: '#666666',
},
axisLine: {
lineStyle: {
color: '#CCCCCC',
},
},
},
seriesTemplate: {
name: '',
type: 'line',
data: [],
areaStyle: {},
label: {
show: true,
color: '#666666',
position: 'top',
},
},
},
pie: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'item',
},
grid: {
top: 40,
bottom: 30,
right: 15,
left: 15,
},
legend: {
bottom: 'left',
},
seriesTemplate: {
name: '',
type: 'pie',
data: [],
radius: '50%',
label: {
show: true,
color: '#666666',
position: 'top',
},
},
},
ring: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'item',
},
grid: {
top: 40,
bottom: 30,
right: 15,
left: 15,
},
legend: {
bottom: 'left',
},
seriesTemplate: {
name: '',
type: 'pie',
data: [],
radius: ['40%', '70%'],
avoidLabelOverlap: false,
label: {
show: true,
color: '#666666',
position: 'top',
},
labelLine: {
show: true,
},
},
},
rose: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'item',
},
legend: {
top: 'bottom',
},
seriesTemplate: {
name: '',
type: 'pie',
data: [],
radius: '55%',
center: ['50%', '50%'],
roseType: 'area',
},
},
funnel: {
color,
title: {
text: '',
},
tooltip: {
trigger: 'item',
formatter: '{b} : {c}%',
},
legend: {
top: 'bottom',
},
seriesTemplate: {
name: '',
type: 'funnel',
left: '10%',
top: 60,
bottom: 60,
width: '80%',
min: 0,
max: 100,
minSize: '0%',
maxSize: '100%',
sort: 'descending',
gap: 2,
label: {
show: true,
position: 'inside',
},
labelLine: {
length: 10,
lineStyle: {
width: 1,
type: 'solid',
},
},
itemStyle: {
bordercolor: '#fff',
borderwidth: 1,
},
emphasis: {
label: {
fontSize: 20,
},
},
data: [],
},
},
gauge: {
color,
tooltip: {
formatter: '{a} <br/>{b} : {c}%',
},
seriesTemplate: {
name: '业务指标',
type: 'gauge',
detail: { formatter: '{value}%' },
data: [{ value: 50, name: '完成率' }],
},
},
candle: {
xAxis: {
data: [],
},
yAxis: {},
color,
title: {
text: '',
},
dataZoom: [
{
type: 'inside',
xAxisIndex: [0, 1],
start: 10,
end: 100,
},
{
show: true,
xAxisIndex: [0, 1],
type: 'slider',
bottom: 10,
start: 10,
end: 100,
},
],
seriesTemplate: {
name: '',
type: 'k',
data: [],
},
},
}
export default cfe
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
<template>
<view class="chartsview">
<view class="charts-error"></view>
<view class="charts-font">{{ errorMessage == null ? '请点击重试' : errorMessage }}</view>
</view>
</template>
<script>
export default {
name: 'qiun-error',
props: {
errorMessage: {
type: String,
default: null,
},
},
data() {
return {}
},
}
</script>
<style>
.chartsview {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.charts-font {
margin-top: 10px;
font-size: 14px;
color: #ccc;
}
.charts-error {
width: 128px;
height: 128px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAUz0lEQVR4Xu1de3Bc1X3+zmp3jYVWfkPAgCWwY8zLEglNQCSW0yT9o2SQaDKdNulUykwfM+k09p+J3ImYIPJXi9yZzDSZZiwyaZuZBCwnNG1DMogEmUAAy7xs/MAyNhCMjWWtsK1deU/n23OvtLu6j3Pv3t29d71nxjOSde455/5+3/m9z7kCjRY4BR7eK7fkcmhrasLT37hbTAY+QYADigDHagwFYGhc7gZwHMAUgG4hMPzNe8RoWInTAECAnHl4r+yREt0DXWIbhx3cJ5fHP8TYjntFR4DTBDqUIwBmMrJDCtyPHDoQw0Q8jkeXinCLtECp43Gwh56R22IxTBbu+KFxOTbQJbo9DlW17rYASGdlNySeKl2JADpbkmKiait0mWhoXHZkmzE52CkocmvavvOsbMvl8MhAl+jlQrg2CQzu6BI9NV2Yw+T2AJiVo+DuL2kSeLQ1KfrC8kLcYbkYBv/pbjEWhjUNjUvSpk9KSAicm2tGXxjAaUcbewBkJAm6xeLBp1PJ2os06ttcDl8H0CEEaGnvGegSg2EAQZTW4B0AEntSS2ov0mhgJc5jmwT6IDEWi2E0zNZ2WEFhC4CZjCRxH7GwAfpbkmIkLC9EFQBg20BXeOySsNBGZx2O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DjCPWPAAAAAASUVORK5CYII=');
background-position: center;
}
</style>
<template>
<view class="container loading1">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading1',
data() {
return {}
},
}
</script>
<style scoped="true">
.container {
position: relative;
width: 30px;
height: 30px;
}
.container.loading1 {
transform: rotate(45deg);
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890ff;
}
.container .shape.shape2 {
right: 0;
background-color: #91cb74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #fac858;
}
.container .shape.shape4 {
right: 0;
bottom: 0;
background-color: #e66;
}
.loading1 .shape1 {
animation: animation1shape1 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape1 {
from {
transform: translate(0, 0);
}
to {
transform: translate(16px, 16px);
}
}
@keyframes animation1shape1 {
from {
transform: translate(0, 0);
}
to {
transform: translate(16px, 16px);
}
}
.loading1 .shape2 {
animation: animation1shape2 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-16px, 16px);
}
}
@keyframes animation1shape2 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-16px, 16px);
}
}
.loading1 .shape3 {
animation: animation1shape3 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape3 {
from {
transform: translate(0, 0);
}
to {
transform: translate(16px, -16px);
}
}
@keyframes animation1shape3 {
from {
transform: translate(0, 0);
}
to {
transform: translate(16px, -16px);
}
}
.loading1 .shape4 {
animation: animation1shape4 0.5s ease 0s infinite alternate;
}
@keyframes animation1shape4 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-16px, -16px);
}
}
@keyframes animation1shape4 {
from {
transform: translate(0, 0);
}
to {
transform: translate(-16px, -16px);
}
}
</style>
<template>
<view class="container loading2">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading2',
data() {
return {}
},
}
</script>
<style scoped="true">
.container {
position: relative;
width: 30px;
height: 30px;
}
.container.loading2 {
transform: rotate(10deg);
transform: rotate(10deg);
}
.container.loading2 .shape {
border-radius: 5px;
}
.container.loading2 {
animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890ff;
}
.container .shape.shape2 {
right: 0;
background-color: #91cb74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #fac858;
}
.container .shape.shape4 {
right: 0;
bottom: 0;
background-color: #e66;
}
.loading2 .shape1 {
animation: animation2shape1 0.5s ease 0s infinite alternate;
animation: animation2shape1 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape1 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(20px, 20px);
transform: translate(20px, 20px);
}
}
@keyframes animation2shape1 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(20px, 20px);
transform: translate(20px, 20px);
}
}
.loading2 .shape2 {
animation: animation2shape2 0.5s ease 0s infinite alternate;
animation: animation2shape2 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape2 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-20px, 20px);
transform: translate(-20px, 20px);
}
}
@keyframes animation2shape2 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-20px, 20px);
transform: translate(-20px, 20px);
}
}
.loading2 .shape3 {
animation: animation2shape3 0.5s ease 0s infinite alternate;
animation: animation2shape3 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape3 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(20px, -20px);
transform: translate(20px, -20px);
}
}
@keyframes animation2shape3 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(20px, -20px);
transform: translate(20px, -20px);
}
}
.loading2 .shape4 {
animation: animation2shape4 0.5s ease 0s infinite alternate;
animation: animation2shape4 0.5s ease 0s infinite alternate;
}
@keyframes animation2shape4 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-20px, -20px);
transform: translate(-20px, -20px);
}
}
@keyframes animation2shape4 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-20px, -20px);
transform: translate(-20px, -20px);
}
}
</style>
<template>
<view class="container loading3">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading3',
data() {
return {}
},
}
</script>
<style scoped="true">
.container {
position: relative;
width: 30px;
height: 30px;
}
.container.loading3 {
animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container.loading3 .shape1 {
border-top-left-radius: 10px;
}
.container.loading3 .shape2 {
border-top-right-radius: 10px;
}
.container.loading3 .shape3 {
border-bottom-left-radius: 10px;
}
.container.loading3 .shape4 {
border-bottom-right-radius: 10px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890ff;
}
.container .shape.shape2 {
right: 0;
background-color: #91cb74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #fac858;
}
.container .shape.shape4 {
right: 0;
bottom: 0;
background-color: #e66;
}
.loading3 .shape1 {
animation: animation3shape1 0.5s ease 0s infinite alternate;
animation: animation3shape1 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape1 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(5px, 5px);
transform: translate(5px, 5px);
}
}
@keyframes animation3shape1 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(5px, 5px);
transform: translate(5px, 5px);
}
}
.loading3 .shape2 {
animation: animation3shape2 0.5s ease 0s infinite alternate;
animation: animation3shape2 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape2 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-5px, 5px);
transform: translate(-5px, 5px);
}
}
@keyframes animation3shape2 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-5px, 5px);
transform: translate(-5px, 5px);
}
}
.loading3 .shape3 {
animation: animation3shape3 0.5s ease 0s infinite alternate;
animation: animation3shape3 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape3 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(5px, -5px);
transform: translate(5px, -5px);
}
}
@keyframes animation3shape3 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(5px, -5px);
transform: translate(5px, -5px);
}
}
.loading3 .shape4 {
animation: animation3shape4 0.5s ease 0s infinite alternate;
animation: animation3shape4 0.5s ease 0s infinite alternate;
}
@keyframes animation3shape4 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-5px, -5px);
transform: translate(-5px, -5px);
}
}
@keyframes animation3shape4 {
from {
transform: translate(0, 0);
transform: translate(0, 0);
}
to {
transform: translate(-5px, -5px);
transform: translate(-5px, -5px);
}
}
</style>
<template>
<view class="container loading5">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading5',
data() {
return {}
},
}
</script>
<style scoped="true">
.container {
position: relative;
width: 30px;
height: 30px;
}
.container.loading5 .shape {
width: 15px;
height: 15px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890ff;
}
.container .shape.shape2 {
right: 0;
background-color: #91cb74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #fac858;
}
.container .shape.shape4 {
right: 0;
bottom: 0;
background-color: #e66;
}
.loading5 .shape1 {
animation: animation5shape1 2s ease 0s infinite reverse;
}
@keyframes animation5shape1 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, 15px);
transform: translate(0, 15px);
}
50% {
transform: translate(15px, 15px);
transform: translate(15px, 15px);
}
75% {
transform: translate(15px, 0);
transform: translate(15px, 0);
}
}
@keyframes animation5shape1 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, 15px);
transform: translate(0, 15px);
}
50% {
transform: translate(15px, 15px);
transform: translate(15px, 15px);
}
75% {
transform: translate(15px, 0);
transform: translate(15px, 0);
}
}
.loading5 .shape2 {
animation: animation5shape2 2s ease 0s infinite reverse;
}
@keyframes animation5shape2 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
50% {
transform: translate(-15px, 15px);
transform: translate(-15px, 15px);
}
75% {
transform: translate(0, 15px);
transform: translate(0, 15px);
}
}
@keyframes animation5shape2 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
50% {
transform: translate(-15px, 15px);
transform: translate(-15px, 15px);
}
75% {
transform: translate(0, 15px);
transform: translate(0, 15px);
}
}
.loading5 .shape3 {
animation: animation5shape3 2s ease 0s infinite reverse;
}
@keyframes animation5shape3 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(15px, 0);
transform: translate(15px, 0);
}
50% {
transform: translate(15px, -15px);
transform: translate(15px, -15px);
}
75% {
transform: translate(0, -15px);
transform: translate(0, -15px);
}
}
@keyframes animation5shape3 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(15px, 0);
transform: translate(15px, 0);
}
50% {
transform: translate(15px, -15px);
transform: translate(15px, -15px);
}
75% {
transform: translate(0, -15px);
transform: translate(0, -15px);
}
}
.loading5 .shape4 {
animation: animation5shape4 2s ease 0s infinite reverse;
}
@keyframes animation5shape4 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, -15px);
transform: translate(0, -15px);
}
50% {
transform: translate(-15px, -15px);
transform: translate(-15px, -15px);
}
75% {
transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
}
@keyframes animation5shape4 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, -15px);
transform: translate(0, -15px);
}
50% {
transform: translate(-15px, -15px);
transform: translate(-15px, -15px);
}
75% {
transform: translate(-15px, 0);
transform: translate(-15px, 0);
}
}
</style>
<template>
<view class="container loading6">
<view class="shape shape1"></view>
<view class="shape shape2"></view>
<view class="shape shape3"></view>
<view class="shape shape4"></view>
</view>
</template>
<script>
export default {
name: 'loading6',
data() {
return {}
},
}
</script>
<style scoped="true">
.container {
position: relative;
width: 30px;
height: 30px;
}
.container.loading6 {
animation: rotation 1s infinite;
animation: rotation 1s infinite;
}
.container.loading6 .shape {
width: 12px;
height: 12px;
border-radius: 2px;
}
.container .shape {
position: absolute;
width: 10px;
height: 10px;
border-radius: 1px;
}
.container .shape.shape1 {
left: 0;
background-color: #1890ff;
}
.container .shape.shape2 {
right: 0;
background-color: #91cb74;
}
.container .shape.shape3 {
bottom: 0;
background-color: #fac858;
}
.container .shape.shape4 {
right: 0;
bottom: 0;
background-color: #e66;
}
.loading6 .shape1 {
animation: animation6shape1 2s linear 0s infinite normal;
animation: animation6shape1 2s linear 0s infinite normal;
}
@keyframes animation6shape1 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, 18px);
transform: translate(0, 18px);
}
50% {
transform: translate(18px, 18px);
transform: translate(18px, 18px);
}
75% {
transform: translate(18px, 0);
transform: translate(18px, 0);
}
}
@keyframes animation6shape1 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, 18px);
transform: translate(0, 18px);
}
50% {
transform: translate(18px, 18px);
transform: translate(18px, 18px);
}
75% {
transform: translate(18px, 0);
transform: translate(18px, 0);
}
}
.loading6 .shape2 {
animation: animation6shape2 2s linear 0s infinite normal;
animation: animation6shape2 2s linear 0s infinite normal;
}
@keyframes animation6shape2 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
50% {
transform: translate(-18px, 18px);
transform: translate(-18px, 18px);
}
75% {
transform: translate(0, 18px);
transform: translate(0, 18px);
}
}
@keyframes animation6shape2 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
50% {
transform: translate(-18px, 18px);
transform: translate(-18px, 18px);
}
75% {
transform: translate(0, 18px);
transform: translate(0, 18px);
}
}
.loading6 .shape3 {
animation: animation6shape3 2s linear 0s infinite normal;
animation: animation6shape3 2s linear 0s infinite normal;
}
@keyframes animation6shape3 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(18px, 0);
transform: translate(18px, 0);
}
50% {
transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
transform: translate(0, -18px);
transform: translate(0, -18px);
}
}
@keyframes animation6shape3 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(18px, 0);
transform: translate(18px, 0);
}
50% {
transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
transform: translate(0, -18px);
transform: translate(0, -18px);
}
}
.loading6 .shape4 {
animation: animation6shape4 2s linear 0s infinite normal;
animation: animation6shape4 2s linear 0s infinite normal;
}
@keyframes animation6shape4 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, -18px);
transform: translate(0, -18px);
}
50% {
transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
75% {
transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
}
@keyframes animation6shape4 {
0% {
transform: translate(0, 0);
transform: translate(0, 0);
}
25% {
transform: translate(0, -18px);
transform: translate(0, -18px);
}
50% {
transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
75% {
transform: translate(-18px, 0);
transform: translate(-18px, 0);
}
}
</style>
<template>
<view>
<Loading1 v-if="loadingType == 1" />
<Loading2 v-if="loadingType == 2" />
<Loading3 v-if="loadingType == 3" />
<Loading4 v-if="loadingType == 4" />
<Loading5 v-if="loadingType == 5" />
</view>
</template>
<script>
import Loading1 from './loading1.vue'
import Loading2 from './loading2.vue'
import Loading3 from './loading3.vue'
import Loading4 from './loading4.vue'
import Loading5 from './loading5.vue'
export default {
components: { Loading1, Loading2, Loading3, Loading4, Loading5 },
name: 'qiun-loading',
props: {
loadingType: {
type: Number,
default: 2,
},
},
data() {
return {}
},
}
</script>
<style></style>
<template>
<view class="qiun-title-bar">
<view class="qiun-title-dot"></view>
<view class="qiun-title-text">{{ title }}</view>
</view>
</template>
<script>
export default {
name: 'title-bar',
props: {
title: {
type: String,
default: '',
},
},
mounted() {},
methods: {},
}
</script>
<style>
.qiun-title-bar {
display: flex;
flex-direction: row !important;
flex-wrap: nowrap;
align-items: center;
height: 40px;
}
.qiun-title-dot {
width: 5px;
height: 16px;
margin-left: 8px;
background-color: #409eff;
border-radius: 10px;
}
.qiun-title-text {
height: 22px;
margin-left: 8px;
font-size: 17px;
font-weight: bold;
line-height: 22px;
color: #666;
}
</style>
/// <reference types="vite/client" />
/// <reference types="vite-svg-loader" />
declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
interface ImportMetaEnv {
readonly VITE_APP_TITLE: string
readonly VITE_SERVER_PORT: string
readonly VITE_SERVER_BASEURL: string
readonly VITE_DELETE_CONSOLE: string
// 更多环境变量...
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
/* eslint-disable import/first */
// 小程序中引入 echarts
// #ifndef APP-PLUS || H5
// eslint-disable-next-line @typescript-eslint/no-var-requires
const echarts = require('../uni_modules/lime-echart/static/echarts.min')
// #endif
// APP 与 H5 引入 echarts
// #ifdef APP-PLUS || H5
import * as echartsAppOrH5 from 'echarts'
// #endif
import { ref } from 'vue'
// echarts 图表 Hooks
export const useEcharts = (options): any => {
// echarts 图实例
const chartRef = ref(null)
// echarts 图绘制函数
const draw = () => {
setTimeout(async () => {
if (!chartRef.value) return
// #ifndef APP-PLUS || H5
const chart = await chartRef.value.init(echarts)
chart.setOption(options.value)
// #endif
// #ifdef APP-PLUS || H5
const chartAPP = await chartRef.value.init(echartsAppOrH5)
chartAPP.setOption(options.value)
// #endif
}, 300)
}
// 这里就封装巧妙之处,如果是对象,那么需要重命名,而是是数组,无需重命名
return [chartRef, options, draw]
}
import { onReady } from '@dcloudio/uni-app'
import { getIsTabbar, getLastItem } from '@/utils/index'
export default () => {
// 获取页面栈
const pages = getCurrentPages()
const isTabbar = getIsTabbar()
// 页面滚动到底部时的操作,通常用于加载更多数据
const onScrollToLower = () => {}
// 获取屏幕边界到安全区域距离
const { safeAreaInsets } = uni.getSystemInfoSync()
// #ifdef MP-WEIXIN
// 基于小程序的 Page 类型扩展 uni-app 的 Page
type PageInstance = Page.PageInstance & WechatMiniprogram.Page.InstanceMethods<any>
// 获取当前页面实例,数组最后一项
const pageInstance = getLastItem(getCurrentPages()) as PageInstance
// 页面渲染完毕,绑定动画效果
onReady(() => {
// 动画效果,导航栏背景色
pageInstance.animate(
'.fly-navbar',
[{ backgroundColor: 'transparent' }, { backgroundColor: '#f8f8f8' }],
1000,
{
scrollSource: '#scroller',
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 50,
},
)
// 动画效果,导航栏标题
pageInstance.animate(
'.fly-navbar .title',
[{ color: 'transparent' }, { color: '#000' }],
1000,
{
scrollSource: '#scroller',
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 50,
},
)
// 动画效果,导航栏返回按钮
pageInstance.animate('.fly-navbar .left-icon', [{ color: '#fff' }, { color: '#000' }], 1000, {
scrollSource: '#scroller',
timeRange: 1000,
startScrollOffset: 0,
endScrollOffset: 50,
})
})
// #endif
return {
pages,
isTabbar,
onScrollToLower,
safeAreaInsets,
}
}
import { UnwrapRef } from 'vue'
type IUseRequestOptions<T> = {
/** 是否立即执行,如果是则在onLoad执行 */
immediate?: boolean
/** 初始化数据 */
initialData?: T
}
/**
* useRequest是一个定制化的请求钩子,用于处理异步请求和响应。
* @param func 一个执行异步请求的函数,返回一个包含响应数据的Promise。
* @param options 包含请求选项的对象 {immediate, initialData}。
* @param options.immediate 是否立即执行请求,默认为true。
* @param options.initialData 初始化数据,默认为undefined。
* @returns 返回一个对象{loading, error, data, run},包含请求的加载状态、错误信息、响应数据和手动触发请求的函数。
*/
export default function useRequest<T>(
func: () => Promise<IResData<T>>,
options: IUseRequestOptions<T> = { immediate: true },
) {
const loading = ref(false)
const error = ref(false)
const data = ref<T>(options.initialData)
const run = async () => {
loading.value = true
func()
.then((res) => {
data.value = res.data as UnwrapRef<T>
error.value = false
})
.catch((err) => {
error.value = err
})
.finally(() => {
loading.value = false
})
}
onLoad(() => {
options.immediate && run()
})
return { loading, error, data, run }
}
// TODO: 别忘加更改环境变量的 VITE_UPLOAD_BASEURL 地址。
const VITE_UPLOAD_BASEURL = import.meta.env.VITE_UPLOAD_BASEURL
/**
* useUpload 是一个定制化的请求钩子,用于处理上传图片。
* @param formData 额外传递给后台的数据,如{name: '菲鸽'}。
* @returns 返回一个对象{loading, error, data, run},包含请求的加载状态、错误信息、响应数据和手动触发请求的函数。
*/
export default function useUpload<T = string>(formData: Record<string, any> = {}) {
const loading = ref(false)
const error = ref(false)
const data = ref<T>()
const run = () => {
// #ifdef MP-WEIXIN
// 微信小程序从基础库 2.21.0 开始, wx.chooseImage 停止维护,请使用 uni.chooseMedia 代替。
// 微信小程序在2023年10月17日之后,使用本API需要配置隐私协议
uni.chooseMedia({
count: 1,
mediaType: ['image'],
success: (res) => {
loading.value = true
const tempFilePath = res.tempFiles[0].tempFilePath
uploadFile<T>({ tempFilePath, formData, data, error, loading })
},
fail: (err) => {
console.log('uni.chooseMedia err->', err)
error.value = true
},
})
// #endif
// #ifndef MP-WEIXIN
uni.chooseImage({
count: 1,
success: (res) => {
loading.value = true
const tempFilePath = res.tempFilePaths[0]
uploadFile<T>({ tempFilePath, formData, data, error, loading })
},
fail: (err) => {
console.log('uni.chooseImage err->', err)
error.value = true
},
})
// #endif
}
return { loading, error, data, run }
}
function uploadFile<T>({ tempFilePath, formData, data, error, loading }) {
uni.uploadFile({
url: VITE_UPLOAD_BASEURL,
filePath: tempFilePath,
name: 'file',
formData,
success: (uploadFileRes) => {
data.value = uploadFileRes.data as T
},
fail: (err) => {
console.log('uni.uploadFile err->', err)
error.value = true
},
complete: () => {
loading.value = false
},
})
}
/* eslint-disable no-unused-vars */
export {}
declare module 'vue' {
interface ComponentCustomProperties {
$t: (key: string, opt?: Record<string, any>) => string
$tm: (key: string, opt?: Record<string, any>) => [] | { [p: string]: any }
}
}
export { routeInterceptor } from './route'
export { requestInterceptor } from './request'
/* eslint-disable no-param-reassign */
import qs from 'qs'
import { useUserStore } from '@/store'
export type CustomRequestOptions = UniApp.RequestOptions & {
query?: Record<string, any>
} & IUniUploadFileOptions // 添加uni.uploadFile参数类型
// 请求基地址
const baseURL = import.meta.env.VITE_SERVER_BASEURL
// 拦截器配置
const httpInterceptor = {
// 拦截前触发
invoke(options: CustomRequestOptions) {
// 接口请求支持通过 query 参数配置 queryString
if (options.query) {
const queryStr = qs.stringify(options.query)
if (options.url.includes('?')) {
options.url += `&${queryStr}`
} else {
options.url += `?${queryStr}`
}
}
// api 目前为 mock 接口,所以无需处理
if (!options.url.startsWith('http')) {
// 1. 非 http 开头需拼接地址
options.url = baseURL + options.url
}
// 2. 请求超时
options.timeout = 10000 // 10s
// 3. 添加小程序端请求头标识
options.header = {
platform: 'mp-weixin', // 可选值与 uniapp 定义的平台一致,告诉后台来源
...options.header,
}
// 4. 添加 token 请求头标识
const userStore = useUserStore()
const { token } = userStore.userInfo as unknown as IUserInfo
if (token) {
options.header.Authorization = `Bearer ${token}`
}
},
}
export const requestInterceptor = {
install() {
// 拦截 request 请求
uni.addInterceptor('request', httpInterceptor)
// 拦截 uploadFile 文件上传
uni.addInterceptor('uploadFile', httpInterceptor)
},
}
/**
* by 菲鸽 on 2024-03-06
* 路由拦截,通常也是登录拦截
* 可以设置路由白名单,或者黑名单,看业务需要选哪一个
* 我这里应为大部分都可以随便进入,所以使用黑名单
*/
import { useUserStore } from '@/store'
import { getNeedLoginPages, needLoginPages as _needLoginPages } from '@/utils'
// TODO Check
const loginRoute = '/pages/login/index'
const isLogined = () => {
const userStore = useUserStore()
return userStore.isLogined
}
const isDev = import.meta.env.DEV
// 黑名单登录拦截器 - (适用于大部分页面不需要登录,少部分页面需要登录)
const navigateToInterceptor = {
// 注意,这里的url是 '/' 开头的,如 '/pages/index/index',跟 'pages.json' 里面的 path 不同
invoke({ url }: { url: string }) {
console.log(url) // /pages/route-interceptor/index?name=feige&age=30
const path = url.split('?')[0]
let needLoginPages: string[] = []
// 为了防止开发时出现BUG,这里每次都获取一下。生产环境可以移到函数外,性能更好
if (isDev) {
needLoginPages = getNeedLoginPages()
} else {
needLoginPages = _needLoginPages
}
console.log(needLoginPages.includes(path))
if (needLoginPages.includes(path)) {
const isLogin = isLogined()
if (isLogin) {
return true
}
const redirectRoute = `${loginRoute}?redirect=${encodeURIComponent(url)}`
uni.navigateTo({ url: redirectRoute })
return false
}
return true
},
}
export const routeInterceptor = {
install() {
uni.addInterceptor('navigateTo', navigateToInterceptor)
uni.addInterceptor('reLaunch', navigateToInterceptor)
uni.addInterceptor('redirectTo', navigateToInterceptor)
},
}
<template>
<view class="default-layout">
<slot />
<wd-toast />
<wd-message-box />
</view>
</template>
<style lang="scss">
.default-layout {
height: 100vh;
/* #ifdef H5 */
padding-bottom: 50px;
overflow: auto;
/* #endif */
}
</style>
<template>
<view class="text-center p-4">
<slot />
<wd-toast />
<wd-message-box />
</view>
</template>
# 注意事项
> 文件夹名字必须为 `locale`, 这是 `uniapp` 官方约定的,如果改为别的,标题将不能正常切换多语言(其他内容还是正常)。
>
> `xxx.json` 的 `xxx` 多语言标识必须与 `uniapp` 官方约定的一致,否则也会出现 BUG。
>
> 查看截图 `screenshots/i18n.png`。
## 参考文档
[uniapp 国际化开发指南](https://uniapp.dcloud.net.cn/tutorial/i18n.html)
[uniapp 国际化-注意事项](https://uniapp.dcloud.net.cn/api/ui/locale.html#onlocalechange) 最下面的注意事项
{
"weight": "{heavy}KG",
"app.name": "En Title"
}
import { createI18n } from 'vue-i18n'
import en from './en.json'
import zhHans from './zh-Hans.json' // 简体中文
const messages = {
en,
'zh-Hans': zhHans, // key 不能乱写,查看截图 screenshots/i18n.png
}
const i18n = createI18n({
locale: uni.getLocale(), // 获取已设置的语言,fallback 语言需要再 manifest.config.ts 中设置
messages,
})
console.log(uni.getLocale())
console.log(i18n.global.locale)
/**
* 非 vue 文件使用这个方法
* @param { string } localeKey 多语言的key,eg: "app.name"
*/
export const translate = (localeKey: string) => {
if (!localeKey) {
console.error(`[i18n] Function translate(), localeKey param is required`)
return ''
}
const locale = uni.getLocale()
console.log('locale:', locale)
const message = messages[locale]
if (Object.keys(message).includes(localeKey)) {
return message[localeKey]
}
return localeKey
}
export default i18n
{
"app.name": "中文标题",
"weight": "{heavy}公斤"
}
import { createSSRApp } from 'vue'
import uvUI from '@climblee/uv-ui'
import App from './App.vue'
import store from './store'
import { routeInterceptor, requestInterceptor } from './interceptors'
import i18n from './locale/index'
import 'virtual:svg-icons-register'
import 'virtual:uno.css'
import '@/style/index.scss'
// production mock server
// 线上报错,TODO: fix me
// if (import.meta.env.PROD) {
// import('../mock/_mockProdServer').then(({ setupProdMockServer }) => {
// console.log('mockProdServer...')
// setupProdMockServer()
// })
// }
export function createApp() {
const app = createSSRApp(App)
app.use(store)
app.use(i18n)
app.use(uvUI)
app.use(routeInterceptor)
app.use(requestInterceptor)
return {
app,
}
}
{
"name": "unibest",
"appid": "H5871D791",
"description": "",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
"modules": {},
"distribute": {
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"minSdkVersion": 30,
"targetSdkVersion": 30,
"abiFilters": [
"armeabi-v7a",
"arm64-v8a"
]
},
"ios": {},
"sdkConfigs": {},
"icons": {
"android": {},
"ios": {}
}
}
},
"quickapp": {},
"mp-weixin": {
"appid": "wxa2abb91f64032a2b",
"setting": {
"urlCheck": false
},
"usingComponents": true
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3",
"locale": "zh-Hans",
"h5": {
"router": {
"base": "/hello-unibest/"
}
}
}
\ No newline at end of file
# 分包配置
在 `vite.config.ts` 中进行配置。
```ts
import { defineConfig } from 'vite'
import UniPages from '@uni-helper/vite-plugin-uni-pages'
export default defineConfig({
plugins: [
UniPages({
// ... 其他配置
subPackages: [
'src/pages-sub', // 是个数组,可以配置多个
],
}),
],
})
```
<route lang="json5" type="page">
{
style: { navigationBarTitleText: '分包页面 标题' },
}
</route>
<template>
<view class="text-center">
<view class="m-8">http://localhost:9000/#/pages-sub/demo/index</view>
<view class="text-green-500">分包页面demo</view>
</view>
</template>
<script lang="ts" setup>
// code here
</script>
<style lang="scss" scoped>
//
</style>
{
"globalStyle": {
"navigationStyle": "default",
"navigationBarTitleText": "unibest",
"navigationBarBackgroundColor": "#f8f8f8",
"navigationBarTextStyle": "black",
"backgroundColor": "#FFFFFF",
"h5": {}
},
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
"^uv-(.*)": "@climblee/uv-ui/components/uv-$1/uv-$1.vue",
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue",
"^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue"
}
},
"tabBar": {
"color": "#999999",
"selectedColor": "#018d71",
"backgroundColor": "#F8F8F8",
"borderStyle": "black",
"height": "50px",
"fontSize": "10px",
"iconWidth": "24px",
"spacing": "3px",
"list": [
{
"iconPath": "static/tabbar/home.png",
"selectedIconPath": "static/tabbar/homeHL.png",
"pagePath": "pages/index/index",
"text": "首页"
},
{
"iconPath": "static/tabbar/example.png",
"selectedIconPath": "static/tabbar/exampleHL.png",
"pagePath": "pages/demo/index",
"text": "示例"
}
]
},
"__esModule": true,
"pages": [
{
"path": "pages/index/index",
"type": "home",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "首页"
}
},
{
"path": "pages/demo/index",
"type": "page",
"style": {
"navigationBarTitleText": "unibest 示例"
}
},
{
"path": "pages/index/request",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "请求"
}
},
{
"path": "pages/login/index",
"type": "page",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/my/index",
"type": "page",
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path": "pages/demo/base/auto-import",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "auto import component"
}
},
{
"path": "pages/demo/base/css",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "css 格式化问题"
}
},
{
"path": "pages/demo/base/enum",
"type": "page",
"hide": true,
"style": {
"navigationBarTitleText": "enum 使用"
}
},
{
"path": "pages/demo/base/env",
"type": "page",
"style": {
"navigationBarTitleText": "环境获取"
}
},
{
"path": "pages/demo/base/iconfont",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "iconfont"
}
},
{
"path": "pages/demo/base/mock",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "mock"
}
},
{
"path": "pages/demo/base/mp-weixin-share",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "微信分享"
}
},
{
"path": "pages/demo/base/navbar",
"type": "page",
"style": {
"navigationBarTitleText": "自定义导航栏",
"navigationStyle": "custom"
}
},
{
"path": "pages/demo/base/no-navbar",
"type": "page",
"style": {
"navigationBarTitleText": "无导航栏",
"navigationStyle": "custom"
}
},
{
"path": "pages/demo/base/pinia",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "pinia+持久化"
}
},
{
"path": "pages/demo/base/request",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "请求"
}
},
{
"path": "pages/demo/base/request2",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "请求(状态一体化)"
}
},
{
"path": "pages/demo/base/route-interceptor",
"type": "page",
"needLogin": true,
"style": {
"navigationBarTitleText": "路由拦截"
}
},
{
"path": "pages/demo/base/svg",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "svg使用"
}
},
{
"path": "pages/demo/base/throughout",
"type": "page",
"style": {
"navigationBarTitleText": "通屏+下拉刷新+自定义导航栏",
"enablePullDownRefresh": false,
"backgroundColor": "#23c09c",
"app-plus": {
"titleNView": {
"type": "transparent"
}
},
"mp-weixin": {
"navigationStyle": "custom"
}
}
},
{
"path": "pages/demo/base/uni-ui-icons",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "UniUI Icons 使用"
}
},
{
"path": "pages/demo/base/uni-ui",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "UniUI 使用"
}
},
{
"path": "pages/demo/base/unocss-icons",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "UnoCss Icons 使用"
}
},
{
"path": "pages/demo/base/unocss",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "UnoCss 使用"
}
},
{
"path": "pages/demo/base/upload",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "上传"
}
},
{
"path": "pages/demo/base/upload2",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "上传+请求状态"
}
},
{
"path": "pages/demo/base/uv-ui",
"type": "page",
"style": {
"navigationBarTitleText": "uv ui"
}
},
{
"path": "pages/demo/base/vconsole",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "小程序vConsole"
}
},
{
"path": "pages/demo/base/wot",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "wot"
}
},
{
"path": "pages/demo/page/clock",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "动态时钟"
}
},
{
"path": "pages/demo/page/clock2",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "动态时钟-抗锯齿"
}
},
{
"path": "pages/demo/page/floating-bubble",
"type": "page",
"layout": "default",
"hide": true,
"style": {
"navigationBarTitleText": "页面悬浮球"
}
},
{
"path": "pages/demo/page/i18n",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "%app.name%"
}
},
{
"path": "pages/demo/page/sign",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "签字板"
}
},
{
"path": "pages/demo/page/waterfall",
"type": "page",
"style": {
"navigationBarTitleText": "waterfall"
}
},
{
"path": "pages/demo/route-interceptor/index",
"type": "page",
"style": {
"navigationBarTitleText": "登陆拦截"
}
},
{
"path": "pages/demo/route-interceptor/login-auto",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "自动登录(无需拦截)"
}
},
{
"path": "pages/demo/route-interceptor/login-model",
"type": "page",
"style": {
"navigationBarTitleText": "登陆拦截 - 登陆弹窗"
}
},
{
"path": "pages/demo/route-interceptor/login-page",
"type": "page",
"needLogin": true,
"style": {
"navigationBarTitleText": "登陆拦截 - 登陆页面"
}
},
{
"path": "pages/demo/page/echarts/index",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "echarts图表"
}
},
{
"path": "pages/demo/page/img-min/index",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "图片压缩"
}
},
{
"path": "pages/demo/page/lottery/big-wheel",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "大转盘抽奖"
}
},
{
"path": "pages/demo/page/lottery/nine-grid",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "九宫格抽奖"
}
},
{
"path": "pages/demo/page/sp-editor/index",
"type": "page",
"layout": "demo",
"style": {
"navigationBarTitleText": "富文本"
}
},
{
"path": "pages/demo/page/ucharts/index",
"type": "page",
"style": {
"navigationBarTitleText": "ucharts 图表"
}
},
{
"path": "pages/demo/page/z-paging/index",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "z-paging"
}
}
],
"subPackages": [
{
"root": "pages-sub",
"pages": [
{
"path": "demo/index",
"type": "page",
"style": {
"navigationBarTitleText": "分包页面 标题"
}
}
]
}
]
}
\ No newline at end of file
<route lang="json5">
{
layout: 'demo',
style: { navigationBarTitleText: 'auto import component' },
}
</route>
<template>
<div>
<h1>欢迎使用 unibest</h1>
<view class="h-10"></view>
<AppTest>这个组件会自动导入</AppTest>
<view class="h-10"></view>
<AppTest2>这个组件会自动导入</AppTest2>
<view class="text-red-700 mt-4">
不可滥用自动导入,不是全局要用的组件不建议放到 `src/components` 里面,会增加包的体积
</view>
</div>
</template>
<route lang="json5">
{
layout: 'demo',
style: {
navigationBarTitleText: '请求',
},
}
</route>
<template>
<view class="p-6 text-center">
<view class="my-2">使用的是 laf 云后台</view>
<view class="text-green-400">我的推荐码,可以获得佣金</view>
<!-- #ifdef H5 -->
<view class="my-2">
<a class="my-2" :href="recommendUrl" target="_blank">{{ recommendUrl }}</a>
</view>
<!-- #endif -->
<!-- #ifndef H5 -->
<view class="my-2 text-left text-sm">{{ recommendUrl }}</view>
<!-- #endif -->
<!-- http://localhost:9000/#/pages/index/request -->
<wd-button @click="run" class="my-6">发送请求</wd-button>
<view class="h-12">
<view v-if="loading">loading...</view>
<block v-else>
<view class="text-xl">请求数据如下</view>
<view class="text-green leading-8">{{ JSON.stringify(data) }}</view>
</block>
</view>
<wd-button type="error" @click="reset" class="my-6" :disabled="!data">重置数据</wd-button>
</view>
</template>
<script lang="ts" setup>
import { getFooAPI, postFooAPI, IFooItem } from '@/service/foo'
const recommendUrl = ref('http://laf.run/signup?code=ohaOgIX')
// const initialData = {
// name: 'initialData',
// id: '1234',
// }
const initialData = undefined
// 适合少部分全局性的接口————多个页面都需要的请求接口,额外编写一个 Service 层
const { loading, error, data, run } = useRequest<IFooItem>(() => getFooAPI('菲鸽'), {
initialData,
})
const reset = () => {
data.value = initialData
}
</script>
<route lang="json5">
{
layout: 'demo',
style: {
navigationBarTitleText: '请求',
},
}
</route>
<template>
<view class="p-6 text-center">
<!-- http://localhost:9000/#/pages/index/request -->
<wd-button @click="getFoo" class="my-6">发送请求</wd-button>
<view class="h-12">
<view v-if="loading1">loading...</view>
<block v-else>
<view class="text-xl">请求数据如下</view>
<view class="text-green leading-8">{{ JSON.stringify(data1) }}</view>
</block>
</view>
<wd-button @click="getBar" class="my-6">发送请求2</wd-button>
<view class="h-12">
<view v-if="loading2">loading...</view>
<block v-else>
<view class="text-xl">请求数据如下</view>
<view class="text-green leading-8">{{ JSON.stringify(data2) }}</view>
</block>
</view>
<wd-button type="error" @click="reset" class="my-6" :disabled="!data1 || !data2">
重置数据
</wd-button>
<wd-button type="success" @click="getAllData" class="my-6 ml-2" :disabled="!!data1 || !!data2">
同时发送请求
</wd-button>
</view>
</template>
<script lang="ts" setup>
import { getFooAPI, postFooAPI, IFooItem } from '@/service/foo'
// 适合少部分全局性的接口————多个页面都需要的请求接口,额外编写一个 Service 层
const {
loading: loading1,
error: err1,
data: data1,
run: getFoo,
} = useRequest<IFooItem>(() => getFooAPI('菲鸽'))
const {
loading: loading2,
error: err2,
data: data2,
run: getBar,
} = useRequest<IFooItem>(() => postFooAPI('菲鸽222'))
const reset = () => {
data1.value = undefined
data2.value = undefined
}
const getAllData = () => {
getFoo()
getBar()
}
</script>
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationBarTitleText: '上传-状态一体化',
},
}
</route>
<template>
<view class="p-4 text-center">
<wd-button @click="run">选择图片并上传</wd-button>
<view v-if="loading" class="text-blue h-10">上传...</view>
<template v-else>
<view class="m-2">上传后返回的接口数据:</view>
<view class="m-2">{{ data }}</view>
<view class="h-80 w-full">
<image v-if="data" :src="data || data" mode="scaleToFill" />
</view>
</template>
</view>
</template>
<script lang="ts" setup>
const { loading, data, run } = useUpload({ user: '菲鸽' })
</script>
<style lang="scss" scoped>
//
</style>
// .test{
// background: #FFF;
// .test1{
// color: #F9FF99;
// }
// }
// 上面的代码在 scss里面格式化是OK的,在Vue里面会有问题
.test {
background: #fff;
.test1 {
color: #f9ff99;
}
}
<route lang="json5" type="page">
{
layout: 'demo',
style: {
navigationBarTitleText: 'css 格式化问题',
},
}
</route>
<template>
<view class="mt-4">
进过多次测试发现,粘贴的css代码块在如下情况时会出现格式化问题:
<view class="ml-4">粘贴的css代码块中类名上面不包含空行(与大小写无关)</view>
<view class="ml-4 text-green-600">1. 中间有空行的,正常,不用处理;</view>
<view class="ml-4 text-red-600">
2. 中间没有空行的,格式化异常,通过 ctrl+Z,ctrl+S 可以搞定
</view>
<image src="./css.png" mode="scaleToFill" class="css-img mt-2" width="688" height="885" />
</view>
</template>
<script lang="ts" setup>
//
</script>
<style lang="scss" scoped>
// 最初的代码如下(版本1)
/*
.test{
background: #FFF;
.test1{
color: #F9FF99;
}
}
*/
// 中间有空行可以正常格式化(版本2)
/*
.test{
background: #FFF;
.test1{
color: #F9FF99;
}
}
*/
// 上面的版本1格式化会变成下面的,错误格式,可以通过 ctrl + z , ctrl + S 解决
// .test {
// background: #fff;
// t1{fff
// color: #F9FF99;
// }
// }
// 上面的版本2格式化会变成下面的,正常
.test {
background: #fff;
.test1 {
color: #f9ff99;
}
}
// 下面是图片的样式,无关
.css-img {
width: 90vw;
max-width: 688px;
height: calc(885 / 688 * 90vw);
max-height: 885px;
}
</style>
<route lang="json5" type="page">
{
hide: true,
style: { navigationBarTitleText: 'enum 使用' },
}
</route>
<template>
<view class="center mt-8 text-green-600">enum 使用,script setup 里面这样写不会报错</view>
</template>
<script lang="ts" setup>
type T = TestEnum.A
const a = 'a' as T
console.log(a)
</script>
<style lang="scss" scoped>
//
</style>
<route lang="json5" type="page">
{
style: { navigationBarTitleText: '环境获取' },
}
</route>
<template>
<view class="mt-4 ml-4">
当前环境 import.meta.env.DEV:
<text class="text-red-500 ml-4">{{ isDev }}</text>
</view>
<view class="mt-4 ml-4">
当前环境所使用的环境文件
<text class="text-red-500 ml-4">{{ VITE_ENV_FILE }}</text>
</view>
<view class="text-red-500 mt-8 ml-4">环境变量的使用与 --mode 参数配合使用</view>
</template>
<script lang="ts" setup>
const isDev = import.meta.env.DEV
const { VITE_ENV_FILE } = import.meta.env
</script>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!