update 升级uview-plus版本

master
管理员 1 year ago
parent 3963e0c2e2
commit ad1688ecb3

@ -56,7 +56,7 @@
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"pinia": "2.0.22", "pinia": "2.0.22",
"pinia-plugin-unistorage": "^0.0.17", "pinia-plugin-unistorage": "^0.0.17",
"uview-plus": "^3.1.38", "uview-plus": "^3.3.31",
"vue": "^3.3.2", "vue": "^3.3.2",
"vue-i18n": "^9.2.2" "vue-i18n": "^9.2.2"
}, },

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
import uviewPlus from 'uview-plus'; import { http } from 'uview-plus';
import { useAuthStore, useCommonStore } from '@/store'; import { useAuthStore, useCommonStore } from '@/store';
import { env } from '@/env'; import { env } from '@/env';
@ -12,10 +12,11 @@ export {
} }
export const HttpConfig = () => { export const HttpConfig = () => {
// 初始化请求配置 // 初始化请求配置
uni.$u.http.setConfig((config) => { http.setConfig((config) => {
/* config 为默认全局配置*/ /* config 为默认全局配置*/
config.baseURL = env.baseApi; config.baseURL = env.baseApi;
@ -31,7 +32,7 @@ export const HttpConfig = ()=>{
}) })
// 请求拦截 // 请求拦截
uni.$u.http.interceptors.request.use((config) => { http.interceptors.request.use((config) => {
// 初始化请求拦截器时会执行此方法此时data为undefined赋予默认{} // 初始化请求拦截器时会执行此方法此时data为undefined赋予默认{}
config.data = config.data || {}; config.data = config.data || {};
config.custom = config.custom || {}; config.custom = config.custom || {};
@ -69,7 +70,7 @@ export const HttpConfig = ()=>{
// 响应拦截 // 响应拦截
uni.$u.http.interceptors.response.use(async (response) => { http.interceptors.response.use(async (response) => {
useCommonStore().hideLoading(); useCommonStore().hideLoading();
const data = response.data; const data = response.data;
const custom = response.config.custom || {}; const custom = response.config.custom || {};
@ -114,4 +115,4 @@ export const HttpConfig = ()=>{
}) })
} }
export const http = uni.$u.http; export { http };

@ -9,6 +9,8 @@ import {
import { env } from '@/env' import { env } from '@/env'
import { throttle, debounce } from 'uview-plus'
const sys = uni.getSystemInfoSync(); const sys = uni.getSystemInfoSync();
const $w = { const $w = {
@ -18,8 +20,8 @@ const $w = {
...sys.safeAreaInsets, ...sys.safeAreaInsets,
...util, ...util,
...uni.$u, ...uni.$u,
t:uni.$u.throttle, t: throttle,
d:uni.$u.debounce, d: debounce,
url: (uri = "") => { url: (uri = "") => {
if (Array.isArray(uri)) { if (Array.isArray(uri)) {
for (let i = 0; i < uri.length; i++) { for (let i = 0; i < uri.length; i++) {

Loading…
Cancel
Save