Auto merge base into i18n

This commit is contained in:
GitHub Actions 2025-04-12 06:09:18 +00:00
commit b2832cdbcc
3 changed files with 24 additions and 3 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "unibest", "name": "unibest",
"type": "commonjs", "type": "commonjs",
"version": "2.5.5", "version": "2.6.3",
"description": "unibest - 最好的 uniapp 开发模板", "description": "unibest - 最好的 uniapp 开发模板",
"author": { "author": {
"name": "feige996", "name": "feige996",

View File

@ -8,8 +8,20 @@ export interface IFooItem {
export const getFooAPI = (name: string) => { export const getFooAPI = (name: string) => {
return http.get<IFooItem>('/foo', { name }) return http.get<IFooItem>('/foo', { name })
} }
/** GET 请求;支持 传递 header 的范例 */
export const getFooAPI2 = (name: string) => {
return http.get<IFooItem>('/foo', { name }, { 'Content-Type-100': '100' })
}
/** POST 请求 */ /** POST 请求 */
export const postFooAPI = (name: string) => { export const postFooAPI = (name: string) => {
return http.post<IFooItem>('/foo', { name }, { name }) return http.post<IFooItem>('/foo', { name })
}
/** POST 请求;需要传递 query 参数的范例微信小程序经常有同时需要query参数和body参数的场景 */
export const postFooAPI2 = (name: string) => {
return http.post<IFooItem>('/foo', { name })
}
/** POST 请求;支持 传递 header 的范例 */
export const postFooAPI3 = (name: string) => {
return http.post<IFooItem>('/foo', { name }, { name }, { 'Content-Type-100': '100' })
} }

View File

@ -46,13 +46,19 @@ export const http = <T>(options: CustomRequestOptions) => {
* GET * GET
* @param url * @param url
* @param query query参数 * @param query query参数
* @param header json格式
* @returns * @returns
*/ */
export const httpGet = <T>(url: string, query?: Record<string, any>) => { export const httpGet = <T>(
url: string,
query?: Record<string, any>,
header?: Record<string, any>,
) => {
return http<T>({ return http<T>({
url, url,
query, query,
method: 'GET', method: 'GET',
header,
}) })
} }
@ -61,18 +67,21 @@ export const httpGet = <T>(url: string, query?: Record<string, any>) => {
* @param url * @param url
* @param data body参数 * @param data body参数
* @param query query参数post请求也支持query * @param query query参数post请求也支持query
* @param header json格式
* @returns * @returns
*/ */
export const httpPost = <T>( export const httpPost = <T>(
url: string, url: string,
data?: Record<string, any>, data?: Record<string, any>,
query?: Record<string, any>, query?: Record<string, any>,
header?: Record<string, any>,
) => { ) => {
return http<T>({ return http<T>({
url, url,
query, query,
data, data,
method: 'POST', method: 'POST',
header,
}) })
} }