uview-ui-wjf 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/changelog.md +388 -0
- package/components/u--form/u--form.vue +92 -0
- package/components/u--image/u--image.vue +73 -0
- package/components/u--input/u--input.vue +115 -0
- package/components/u--text/u--text.vue +72 -0
- package/components/u--textarea/u--textarea.vue +85 -0
- package/components/u-action-sheet/props.js +54 -0
- package/components/u-action-sheet/u-action-sheet.vue +278 -0
- package/components/u-album/props.js +59 -0
- package/components/u-album/u-album.vue +259 -0
- package/components/u-alert/props.js +44 -0
- package/components/u-alert/u-alert.vue +243 -0
- package/components/u-avatar/props.js +78 -0
- package/components/u-avatar/u-avatar.vue +173 -0
- package/components/u-avatar-group/props.js +52 -0
- package/components/u-avatar-group/u-avatar-group.vue +103 -0
- package/components/u-back-top/props.js +54 -0
- package/components/u-back-top/u-back-top.vue +129 -0
- package/components/u-badge/props.js +72 -0
- package/components/u-badge/u-badge.vue +171 -0
- package/components/u-button/nvue.scss +46 -0
- package/components/u-button/props.js +161 -0
- package/components/u-button/u-button.vue +495 -0
- package/components/u-button/vue.scss +80 -0
- package/components/u-calendar/header.vue +99 -0
- package/components/u-calendar/month.vue +579 -0
- package/components/u-calendar/props.js +144 -0
- package/components/u-calendar/u-calendar.vue +384 -0
- package/components/u-calendar/util.js +85 -0
- package/components/u-car-keyboard/props.js +14 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +311 -0
- package/components/u-cell/props.js +110 -0
- package/components/u-cell/u-cell.vue +229 -0
- package/components/u-cell-group/props.js +14 -0
- package/components/u-cell-group/u-cell-group.vue +61 -0
- package/components/u-checkbox/props.js +69 -0
- package/components/u-checkbox/u-checkbox.vue +344 -0
- package/components/u-checkbox-group/props.js +82 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +103 -0
- package/components/u-circle-progress/props.js +8 -0
- package/components/u-circle-progress/u-circle-progress.vue +198 -0
- package/components/u-code/props.js +34 -0
- package/components/u-code/u-code.vue +129 -0
- package/components/u-code-input/props.js +79 -0
- package/components/u-code-input/u-code-input.vue +252 -0
- package/components/u-col/props.js +29 -0
- package/components/u-col/u-col.vue +162 -0
- package/components/u-collapse/props.js +19 -0
- package/components/u-collapse/u-collapse.vue +90 -0
- package/components/u-collapse-item/props.js +59 -0
- package/components/u-collapse-item/u-collapse-item.vue +225 -0
- package/components/u-column-notice/props.js +55 -0
- package/components/u-column-notice/u-column-notice.vue +160 -0
- package/components/u-count-down/props.js +24 -0
- package/components/u-count-down/u-count-down.vue +163 -0
- package/components/u-count-down/utils.js +62 -0
- package/components/u-count-to/props.js +59 -0
- package/components/u-count-to/u-count-to.vue +184 -0
- package/components/u-datetime-picker/props.js +120 -0
- package/components/u-datetime-picker/u-datetime-picker.vue +361 -0
- package/components/u-divider/props.js +44 -0
- package/components/u-divider/u-divider.vue +116 -0
- package/components/u-dropdown/props.js +65 -0
- package/components/u-dropdown/u-dropdown.vue +127 -0
- package/components/u-dropdown-item/props.js +36 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +127 -0
- package/components/u-empty/props.js +59 -0
- package/components/u-empty/u-empty.vue +128 -0
- package/components/u-form/props.js +45 -0
- package/components/u-form/u-form.vue +214 -0
- package/components/u-form-item/props.js +48 -0
- package/components/u-form-item/u-form-item.vue +235 -0
- package/components/u-gap/props.js +24 -0
- package/components/u-gap/u-gap.vue +38 -0
- package/components/u-grid/props.js +19 -0
- package/components/u-grid/u-grid.vue +97 -0
- package/components/u-grid-item/props.js +14 -0
- package/components/u-grid-item/u-grid-item.vue +209 -0
- package/components/u-icon/icons.js +214 -0
- package/components/u-icon/props.js +89 -0
- package/components/u-icon/u-icon.vue +237 -0
- package/components/u-image/props.js +84 -0
- package/components/u-image/u-image.vue +232 -0
- package/components/u-index-anchor/props.js +29 -0
- package/components/u-index-anchor/u-index-anchor.vue +91 -0
- package/components/u-index-item/props.js +5 -0
- package/components/u-index-item/u-index-item.vue +87 -0
- package/components/u-index-list/props.js +29 -0
- package/components/u-index-list/u-index-list.vue +440 -0
- package/components/u-input/props.js +187 -0
- package/components/u-input/u-input.vue +369 -0
- package/components/u-keyboard/props.js +84 -0
- package/components/u-keyboard/u-keyboard.vue +164 -0
- package/components/u-line/props.js +33 -0
- package/components/u-line/u-line.vue +62 -0
- package/components/u-line-progress/props.js +28 -0
- package/components/u-line-progress/u-line-progress.vue +144 -0
- package/components/u-link/props.js +39 -0
- package/components/u-link/u-link.vue +83 -0
- package/components/u-list/props.js +76 -0
- package/components/u-list/u-list.vue +157 -0
- package/components/u-list-item/props.js +9 -0
- package/components/u-list-item/u-list-item.vue +116 -0
- package/components/u-loading-icon/props.js +59 -0
- package/components/u-loading-icon/u-loading-icon.vue +343 -0
- package/components/u-loading-page/props.js +49 -0
- package/components/u-loading-page/u-loading-page.vue +115 -0
- package/components/u-loadmore/props.js +94 -0
- package/components/u-loadmore/u-loadmore.vue +150 -0
- package/components/u-modal/props.js +89 -0
- package/components/u-modal/u-modal.vue +228 -0
- package/components/u-navbar/props.js +84 -0
- package/components/u-navbar/u-navbar.vue +186 -0
- package/components/u-no-network/props.js +19 -0
- package/components/u-no-network/u-no-network.vue +220 -0
- package/components/u-notice-bar/props.js +70 -0
- package/components/u-notice-bar/u-notice-bar.vue +101 -0
- package/components/u-notify/props.js +49 -0
- package/components/u-notify/u-notify.vue +211 -0
- package/components/u-number-box/props.js +109 -0
- package/components/u-number-box/u-number-box.vue +416 -0
- package/components/u-number-keyboard/props.js +19 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +196 -0
- package/components/u-overlay/props.js +24 -0
- package/components/u-overlay/u-overlay.vue +68 -0
- package/components/u-parse/node/node.vue +499 -0
- package/components/u-parse/parser.js +1075 -0
- package/components/u-parse/props.js +45 -0
- package/components/u-parse/u-parse.vue +366 -0
- package/components/u-picker/props.js +79 -0
- package/components/u-picker/u-picker.vue +286 -0
- package/components/u-picker-column/props.js +5 -0
- package/components/u-picker-column/u-picker-column.vue +27 -0
- package/components/u-popup/props.js +79 -0
- package/components/u-popup/u-popup.vue +304 -0
- package/components/u-radio/props.js +64 -0
- package/components/u-radio/u-radio.vue +339 -0
- package/components/u-radio-group/props.js +85 -0
- package/components/u-radio-group/u-radio-group.vue +108 -0
- package/components/u-rate/props.js +69 -0
- package/components/u-rate/u-rate.vue +306 -0
- package/components/u-read-more/props.js +61 -0
- package/components/u-read-more/u-read-more.vue +157 -0
- package/components/u-row/props.js +19 -0
- package/components/u-row/u-row.vue +93 -0
- package/components/u-row-notice/props.js +39 -0
- package/components/u-row-notice/u-row-notice.vue +330 -0
- package/components/u-safe-bottom/props.js +5 -0
- package/components/u-safe-bottom/u-safe-bottom.vue +56 -0
- package/components/u-scroll-list/nvue.js +28 -0
- package/components/u-scroll-list/other.js +0 -0
- package/components/u-scroll-list/props.js +34 -0
- package/components/u-scroll-list/scrollWxs.wxs +50 -0
- package/components/u-scroll-list/u-scroll-list.vue +224 -0
- package/components/u-search/props.js +118 -0
- package/components/u-search/u-search.vue +303 -0
- package/components/u-skeleton/props.js +59 -0
- package/components/u-skeleton/u-skeleton.vue +244 -0
- package/components/u-slider/mpother.js +113 -0
- package/components/u-slider/mpwxs.js +42 -0
- package/components/u-slider/mpwxs.wxs +121 -0
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +180 -0
- package/components/u-slider/nvue.js +193 -0
- package/components/u-slider/props.js +54 -0
- package/components/u-slider/u-slider.vue +55 -0
- package/components/u-status-bar/props.js +8 -0
- package/components/u-status-bar/u-status-bar.vue +46 -0
- package/components/u-steps/props.js +39 -0
- package/components/u-steps/u-steps.vue +80 -0
- package/components/u-steps-item/props.js +24 -0
- package/components/u-steps-item/u-steps-item.vue +316 -0
- package/components/u-sticky/props.js +40 -0
- package/components/u-sticky/u-sticky.vue +212 -0
- package/components/u-subsection/props.js +49 -0
- package/components/u-subsection/u-subsection.vue +299 -0
- package/components/u-swipe-action/props.js +9 -0
- package/components/u-swipe-action/u-swipe-action.vue +67 -0
- package/components/u-swipe-action-item/index - backup.wxs +256 -0
- package/components/u-swipe-action-item/index.wxs +225 -0
- package/components/u-swipe-action-item/nvue - backup.js +270 -0
- package/components/u-swipe-action-item/nvue.js +174 -0
- package/components/u-swipe-action-item/props.js +41 -0
- package/components/u-swipe-action-item/u-swipe-action-item.vue +190 -0
- package/components/u-swipe-action-item/wxs.js +15 -0
- package/components/u-swiper/props.js +125 -0
- package/components/u-swiper/u-swiper.vue +255 -0
- package/components/u-swiper-indicator/props.js +29 -0
- package/components/u-swiper-indicator/u-swiper-indicator.vue +110 -0
- package/components/u-switch/props.js +54 -0
- package/components/u-switch/u-switch.vue +177 -0
- package/components/u-tabbar/props.js +44 -0
- package/components/u-tabbar/u-tabbar.vue +141 -0
- package/components/u-tabbar-item/props.js +35 -0
- package/components/u-tabbar-item/u-tabbar-item.vue +142 -0
- package/components/u-table/props.js +5 -0
- package/components/u-table/u-table.vue +29 -0
- package/components/u-tabs/props.js +64 -0
- package/components/u-tabs/u-tabs.vue +363 -0
- package/components/u-tabs-item/props.js +5 -0
- package/components/u-tabs-item/u-tabs-item.vue +29 -0
- package/components/u-tag/props.js +84 -0
- package/components/u-tag/u-tag.vue +358 -0
- package/components/u-td/props.js +5 -0
- package/components/u-td/u-td.vue +31 -0
- package/components/u-text/props.js +110 -0
- package/components/u-text/u-text.vue +223 -0
- package/components/u-text/value.js +85 -0
- package/components/u-textarea/props.js +119 -0
- package/components/u-textarea/u-textarea.vue +239 -0
- package/components/u-toast/u-toast.vue +291 -0
- package/components/u-toolbar/props.js +34 -0
- package/components/u-toolbar/u-toolbar.vue +102 -0
- package/components/u-tooltip/clipboard.min.js +58 -0
- package/components/u-tooltip/props.js +59 -0
- package/components/u-tooltip/u-tooltip.vue +366 -0
- package/components/u-tr/props.js +5 -0
- package/components/u-tr/u-tr.vue +31 -0
- package/components/u-transition/nvue.ani-map.js +68 -0
- package/components/u-transition/props.js +24 -0
- package/components/u-transition/transition.js +157 -0
- package/components/u-transition/u-transition.vue +92 -0
- package/components/u-transition/vue.ani-style.scss +113 -0
- package/components/u-upload/mixin.js +21 -0
- package/components/u-upload/props.js +124 -0
- package/components/u-upload/u-upload.vue +566 -0
- package/components/u-upload/utils.js +151 -0
- package/components/uview-ui/uview-ui.vue +15 -0
- package/index.js +79 -0
- package/index.scss +23 -0
- package/libs/config/color.js +17 -0
- package/libs/config/config.js +34 -0
- package/libs/config/props/actionSheet.js +25 -0
- package/libs/config/props/album.js +25 -0
- package/libs/config/props/alert.js +22 -0
- package/libs/config/props/avatar.js +28 -0
- package/libs/config/props/avatarGroup.js +23 -0
- package/libs/config/props/backtop.js +27 -0
- package/libs/config/props/badge.js +27 -0
- package/libs/config/props/button.js +42 -0
- package/libs/config/props/calendar.js +42 -0
- package/libs/config/props/carKeyboard.js +15 -0
- package/libs/config/props/cell.js +35 -0
- package/libs/config/props/cellGroup.js +17 -0
- package/libs/config/props/checkbox.js +27 -0
- package/libs/config/props/checkboxGroup.js +29 -0
- package/libs/config/props/circleProgress.js +15 -0
- package/libs/config/props/code.js +21 -0
- package/libs/config/props/codeInput.js +29 -0
- package/libs/config/props/col.js +19 -0
- package/libs/config/props/collapse.js +17 -0
- package/libs/config/props/collapseItem.js +25 -0
- package/libs/config/props/columnNotice.js +24 -0
- package/libs/config/props/countDown.js +18 -0
- package/libs/config/props/countTo.js +25 -0
- package/libs/config/props/datetimePicker.js +37 -0
- package/libs/config/props/divider.js +23 -0
- package/libs/config/props/empty.js +26 -0
- package/libs/config/props/form.js +22 -0
- package/libs/config/props/formItem.js +23 -0
- package/libs/config/props/gap.js +19 -0
- package/libs/config/props/grid.js +17 -0
- package/libs/config/props/gridItem.js +16 -0
- package/libs/config/props/icon.js +36 -0
- package/libs/config/props/image.js +30 -0
- package/libs/config/props/indexAnchor.js +19 -0
- package/libs/config/props/indexList.js +19 -0
- package/libs/config/props/input.js +48 -0
- package/libs/config/props/keyboard.js +30 -0
- package/libs/config/props/line.js +20 -0
- package/libs/config/props/lineProgress.js +19 -0
- package/libs/config/props/link.js +26 -0
- package/libs/config/props/list.js +28 -0
- package/libs/config/props/listItem.js +15 -0
- package/libs/config/props/loadingIcon.js +30 -0
- package/libs/config/props/loadingPage.js +23 -0
- package/libs/config/props/loadmore.js +32 -0
- package/libs/config/props/modal.js +31 -0
- package/libs/config/props/navbar.js +32 -0
- package/libs/config/props/noNetwork.js +18 -0
- package/libs/config/props/noticeBar.js +27 -0
- package/libs/config/props/notify.js +22 -0
- package/libs/config/props/numberBox.js +35 -0
- package/libs/config/props/numberKeyboard.js +17 -0
- package/libs/config/props/overlay.js +18 -0
- package/libs/config/props/parse.js +22 -0
- package/libs/config/props/picker.js +29 -0
- package/libs/config/props/popup.js +29 -0
- package/libs/config/props/radio.js +27 -0
- package/libs/config/props/radioGroup.js +30 -0
- package/libs/config/props/rate.js +26 -0
- package/libs/config/props/readMore.js +22 -0
- package/libs/config/props/row.js +17 -0
- package/libs/config/props/rowNotice.js +21 -0
- package/libs/config/props/scrollList.js +20 -0
- package/libs/config/props/search.js +37 -0
- package/libs/config/props/section.js +24 -0
- package/libs/config/props/skeleton.js +25 -0
- package/libs/config/props/slider.js +25 -0
- package/libs/config/props/statusBar.js +15 -0
- package/libs/config/props/steps.js +21 -0
- package/libs/config/props/stepsItem.js +18 -0
- package/libs/config/props/sticky.js +20 -0
- package/libs/config/props/subsection.js +23 -0
- package/libs/config/props/swipeAction.js +15 -0
- package/libs/config/props/swipeActionItem.js +21 -0
- package/libs/config/props/swiper.js +39 -0
- package/libs/config/props/swipterIndicator.js +19 -0
- package/libs/config/props/switch.js +24 -0
- package/libs/config/props/tabbar.js +22 -0
- package/libs/config/props/tabbarItem.js +20 -0
- package/libs/config/props/tabs.js +32 -0
- package/libs/config/props/tag.js +29 -0
- package/libs/config/props/text.js +38 -0
- package/libs/config/props/textarea.js +36 -0
- package/libs/config/props/toast.js +30 -0
- package/libs/config/props/toolbar.js +21 -0
- package/libs/config/props/tooltip.js +25 -0
- package/libs/config/props/transition.js +18 -0
- package/libs/config/props/upload.js +36 -0
- package/libs/config/props.js +190 -0
- package/libs/config/zIndex.js +20 -0
- package/libs/css/color.scss +155 -0
- package/libs/css/common.scss +97 -0
- package/libs/css/components.scss +15 -0
- package/libs/css/flex.scss +257 -0
- package/libs/css/h5.scss +0 -0
- package/libs/css/mixin.scss +8 -0
- package/libs/css/mp.scss +0 -0
- package/libs/css/nvue.scss +0 -0
- package/libs/css/vue.scss +27 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +731 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +288 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +97 -0
- package/libs/luch-request/core/InterceptorManager.js +50 -0
- package/libs/luch-request/core/Request.js +198 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +29 -0
- package/libs/luch-request/core/dispatchRequest.js +3 -0
- package/libs/luch-request/core/mergeConfig.js +103 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +69 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +116 -0
- package/libs/luch-request/index.js +3 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +131 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +160 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +25 -0
- package/libs/mixin/style.js +228 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/async-validator.js +1343 -0
- package/libs/util/calendar.js +546 -0
- package/libs/util/dayjs.js +308 -0
- package/libs/util/emitter.js +51 -0
- package/libs/util/route.js +124 -0
- package/package.json +83 -0
- package/theme.scss +44 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Class Request
|
|
3
|
+
* @description luch-request http请求插件
|
|
4
|
+
* @version 3.0.7
|
|
5
|
+
* @Author lu-ch
|
|
6
|
+
* @Date 2021-09-04
|
|
7
|
+
* @Email webwork.s@qq.com
|
|
8
|
+
* 文档: https://www.quanzhan.co/luch-request/
|
|
9
|
+
* github: https://github.com/lei-mu/luch-request
|
|
10
|
+
* DCloud: http://ext.dcloud.net.cn/plugin?id=392
|
|
11
|
+
* HBuilderX: beat-3.0.4 alpha-3.0.4
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import dispatchRequest from './dispatchRequest'
|
|
15
|
+
import InterceptorManager from './InterceptorManager'
|
|
16
|
+
import mergeConfig from './mergeConfig'
|
|
17
|
+
import defaults from './defaults'
|
|
18
|
+
import { isPlainObject } from '../utils'
|
|
19
|
+
import clone from '../utils/clone'
|
|
20
|
+
|
|
21
|
+
export default class Request {
|
|
22
|
+
/**
|
|
23
|
+
* @param {Object} arg - 全局配置
|
|
24
|
+
* @param {String} arg.baseURL - 全局根路径
|
|
25
|
+
* @param {Object} arg.header - 全局header
|
|
26
|
+
* @param {String} arg.method = [GET|POST|PUT|DELETE|CONNECT|HEAD|OPTIONS|TRACE] - 全局默认请求方式
|
|
27
|
+
* @param {String} arg.dataType = [json] - 全局默认的dataType
|
|
28
|
+
* @param {String} arg.responseType = [text|arraybuffer] - 全局默认的responseType。支付宝小程序不支持
|
|
29
|
+
* @param {Object} arg.custom - 全局默认的自定义参数
|
|
30
|
+
* @param {Number} arg.timeout - 全局默认的超时时间,单位 ms。默认60000。H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)、微信小程序(2.10.0)、支付宝小程序
|
|
31
|
+
* @param {Boolean} arg.sslVerify - 全局默认的是否验证 ssl 证书。默认true.仅App安卓端支持(HBuilderX 2.3.3+)
|
|
32
|
+
* @param {Boolean} arg.withCredentials - 全局默认的跨域请求时是否携带凭证(cookies)。默认false。仅H5支持(HBuilderX 2.6.15+)
|
|
33
|
+
* @param {Boolean} arg.firstIpv4 - 全DNS解析时优先使用ipv4。默认false。仅 App-Android 支持 (HBuilderX 2.8.0+)
|
|
34
|
+
* @param {Function(statusCode):Boolean} arg.validateStatus - 全局默认的自定义验证器。默认statusCode >= 200 && statusCode < 300
|
|
35
|
+
*/
|
|
36
|
+
constructor(arg = {}) {
|
|
37
|
+
if (!isPlainObject(arg)) {
|
|
38
|
+
arg = {}
|
|
39
|
+
console.warn('设置全局参数必须接收一个Object')
|
|
40
|
+
}
|
|
41
|
+
this.config = clone({ ...defaults, ...arg })
|
|
42
|
+
this.interceptors = {
|
|
43
|
+
request: new InterceptorManager(),
|
|
44
|
+
response: new InterceptorManager()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @Function
|
|
50
|
+
* @param {Request~setConfigCallback} f - 设置全局默认配置
|
|
51
|
+
*/
|
|
52
|
+
setConfig(f) {
|
|
53
|
+
this.config = f(this.config)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
middleware(config) {
|
|
57
|
+
config = mergeConfig(this.config, config)
|
|
58
|
+
const chain = [dispatchRequest, undefined]
|
|
59
|
+
let promise = Promise.resolve(config)
|
|
60
|
+
|
|
61
|
+
this.interceptors.request.forEach((interceptor) => {
|
|
62
|
+
chain.unshift(interceptor.fulfilled, interceptor.rejected)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
this.interceptors.response.forEach((interceptor) => {
|
|
66
|
+
chain.push(interceptor.fulfilled, interceptor.rejected)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
while (chain.length) {
|
|
70
|
+
promise = promise.then(chain.shift(), chain.shift())
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return promise
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @Function
|
|
78
|
+
* @param {Object} config - 请求配置项
|
|
79
|
+
* @prop {String} options.url - 请求路径
|
|
80
|
+
* @prop {Object} options.data - 请求参数
|
|
81
|
+
* @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型
|
|
82
|
+
* @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse
|
|
83
|
+
* @prop {Object} [options.header = config.header] - 请求header
|
|
84
|
+
* @prop {Object} [options.method = config.method] - 请求方法
|
|
85
|
+
* @returns {Promise<unknown>}
|
|
86
|
+
*/
|
|
87
|
+
request(config = {}) {
|
|
88
|
+
return this.middleware(config)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get(url, options = {}) {
|
|
92
|
+
return this.middleware({
|
|
93
|
+
url,
|
|
94
|
+
method: 'GET',
|
|
95
|
+
...options
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
post(url, data, options = {}) {
|
|
100
|
+
return this.middleware({
|
|
101
|
+
url,
|
|
102
|
+
data,
|
|
103
|
+
method: 'POST',
|
|
104
|
+
...options
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// #ifndef MP-ALIPAY
|
|
109
|
+
put(url, data, options = {}) {
|
|
110
|
+
return this.middleware({
|
|
111
|
+
url,
|
|
112
|
+
data,
|
|
113
|
+
method: 'PUT',
|
|
114
|
+
...options
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// #endif
|
|
119
|
+
|
|
120
|
+
// #ifdef APP-PLUS || H5 || MP-WEIXIN || MP-BAIDU
|
|
121
|
+
delete(url, data, options = {}) {
|
|
122
|
+
return this.middleware({
|
|
123
|
+
url,
|
|
124
|
+
data,
|
|
125
|
+
method: 'DELETE',
|
|
126
|
+
...options
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// #endif
|
|
131
|
+
|
|
132
|
+
// #ifdef H5 || MP-WEIXIN
|
|
133
|
+
connect(url, data, options = {}) {
|
|
134
|
+
return this.middleware({
|
|
135
|
+
url,
|
|
136
|
+
data,
|
|
137
|
+
method: 'CONNECT',
|
|
138
|
+
...options
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// #endif
|
|
143
|
+
|
|
144
|
+
// #ifdef H5 || MP-WEIXIN || MP-BAIDU
|
|
145
|
+
head(url, data, options = {}) {
|
|
146
|
+
return this.middleware({
|
|
147
|
+
url,
|
|
148
|
+
data,
|
|
149
|
+
method: 'HEAD',
|
|
150
|
+
...options
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// #endif
|
|
155
|
+
|
|
156
|
+
// #ifdef APP-PLUS || H5 || MP-WEIXIN || MP-BAIDU
|
|
157
|
+
options(url, data, options = {}) {
|
|
158
|
+
return this.middleware({
|
|
159
|
+
url,
|
|
160
|
+
data,
|
|
161
|
+
method: 'OPTIONS',
|
|
162
|
+
...options
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// #endif
|
|
167
|
+
|
|
168
|
+
// #ifdef H5 || MP-WEIXIN
|
|
169
|
+
trace(url, data, options = {}) {
|
|
170
|
+
return this.middleware({
|
|
171
|
+
url,
|
|
172
|
+
data,
|
|
173
|
+
method: 'TRACE',
|
|
174
|
+
...options
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// #endif
|
|
179
|
+
|
|
180
|
+
upload(url, config = {}) {
|
|
181
|
+
config.url = url
|
|
182
|
+
config.method = 'UPLOAD'
|
|
183
|
+
return this.middleware(config)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
download(url, config = {}) {
|
|
187
|
+
config.url = url
|
|
188
|
+
config.method = 'DOWNLOAD'
|
|
189
|
+
return this.middleware(config)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* setConfig回调
|
|
195
|
+
* @return {Object} - 返回操作后的config
|
|
196
|
+
* @callback Request~setConfigCallback
|
|
197
|
+
* @param {Object} config - 全局默认config
|
|
198
|
+
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import isAbsoluteURL from '../helpers/isAbsoluteURL'
|
|
4
|
+
import combineURLs from '../helpers/combineURLs'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
8
|
+
* only when the requestedURL is not already an absolute URL.
|
|
9
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} baseURL The base URL
|
|
12
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
13
|
+
* @returns {string} The combined full path
|
|
14
|
+
*/
|
|
15
|
+
export default function buildFullPath(baseURL, requestedURL) {
|
|
16
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
17
|
+
return combineURLs(baseURL, requestedURL)
|
|
18
|
+
}
|
|
19
|
+
return requestedURL
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 默认的全局配置
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
baseURL: '',
|
|
7
|
+
header: {},
|
|
8
|
+
method: 'GET',
|
|
9
|
+
dataType: 'json',
|
|
10
|
+
// #ifndef MP-ALIPAY
|
|
11
|
+
responseType: 'text',
|
|
12
|
+
// #endif
|
|
13
|
+
custom: {},
|
|
14
|
+
// #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
|
|
15
|
+
timeout: 60000,
|
|
16
|
+
// #endif
|
|
17
|
+
// #ifdef APP-PLUS
|
|
18
|
+
sslVerify: true,
|
|
19
|
+
// #endif
|
|
20
|
+
// #ifdef H5
|
|
21
|
+
withCredentials: false,
|
|
22
|
+
// #endif
|
|
23
|
+
// #ifdef APP-PLUS
|
|
24
|
+
firstIpv4: false,
|
|
25
|
+
// #endif
|
|
26
|
+
validateStatus: function validateStatus(status) {
|
|
27
|
+
return status >= 200 && status < 300
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { deepMerge, isUndefined } from '../utils'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 合并局部配置优先的配置,如果局部有该配置项则用局部,如果全局有该配置项则用全局
|
|
5
|
+
* @param {Array} keys - 配置项
|
|
6
|
+
* @param {Object} globalsConfig - 当前的全局配置
|
|
7
|
+
* @param {Object} config2 - 局部配置
|
|
8
|
+
* @return {{}}
|
|
9
|
+
*/
|
|
10
|
+
const mergeKeys = (keys, globalsConfig, config2) => {
|
|
11
|
+
const config = {}
|
|
12
|
+
keys.forEach((prop) => {
|
|
13
|
+
if (!isUndefined(config2[prop])) {
|
|
14
|
+
config[prop] = config2[prop]
|
|
15
|
+
} else if (!isUndefined(globalsConfig[prop])) {
|
|
16
|
+
config[prop] = globalsConfig[prop]
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
return config
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param globalsConfig - 当前实例的全局配置
|
|
24
|
+
* @param config2 - 当前的局部配置
|
|
25
|
+
* @return - 合并后的配置
|
|
26
|
+
*/
|
|
27
|
+
export default (globalsConfig, config2 = {}) => {
|
|
28
|
+
const method = config2.method || globalsConfig.method || 'GET'
|
|
29
|
+
let config = {
|
|
30
|
+
baseURL: globalsConfig.baseURL || '',
|
|
31
|
+
method,
|
|
32
|
+
url: config2.url || '',
|
|
33
|
+
params: config2.params || {},
|
|
34
|
+
custom: { ...(globalsConfig.custom || {}), ...(config2.custom || {}) },
|
|
35
|
+
header: deepMerge(globalsConfig.header || {}, config2.header || {})
|
|
36
|
+
}
|
|
37
|
+
const defaultToConfig2Keys = ['getTask', 'validateStatus']
|
|
38
|
+
config = { ...config, ...mergeKeys(defaultToConfig2Keys, globalsConfig, config2) }
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line no-empty
|
|
41
|
+
if (method === 'DOWNLOAD') {
|
|
42
|
+
// #ifdef H5 || APP-PLUS
|
|
43
|
+
if (!isUndefined(config2.timeout)) {
|
|
44
|
+
config.timeout = config2.timeout
|
|
45
|
+
} else if (!isUndefined(globalsConfig.timeout)) {
|
|
46
|
+
config.timeout = globalsConfig.timeout
|
|
47
|
+
}
|
|
48
|
+
// #endif
|
|
49
|
+
} else if (method === 'UPLOAD') {
|
|
50
|
+
delete config.header['content-type']
|
|
51
|
+
delete config.header['Content-Type']
|
|
52
|
+
const uploadKeys = [
|
|
53
|
+
// #ifdef APP-PLUS || H5
|
|
54
|
+
'files',
|
|
55
|
+
// #endif
|
|
56
|
+
// #ifdef MP-ALIPAY
|
|
57
|
+
'fileType',
|
|
58
|
+
// #endif
|
|
59
|
+
// #ifdef H5
|
|
60
|
+
'file',
|
|
61
|
+
// #endif
|
|
62
|
+
'filePath',
|
|
63
|
+
'name',
|
|
64
|
+
// #ifdef H5 || APP-PLUS
|
|
65
|
+
'timeout',
|
|
66
|
+
// #endif
|
|
67
|
+
'formData'
|
|
68
|
+
]
|
|
69
|
+
uploadKeys.forEach((prop) => {
|
|
70
|
+
if (!isUndefined(config2[prop])) {
|
|
71
|
+
config[prop] = config2[prop]
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
// #ifdef H5 || APP-PLUS
|
|
75
|
+
if (isUndefined(config.timeout) && !isUndefined(globalsConfig.timeout)) {
|
|
76
|
+
config.timeout = globalsConfig.timeout
|
|
77
|
+
}
|
|
78
|
+
// #endif
|
|
79
|
+
} else {
|
|
80
|
+
const defaultsKeys = [
|
|
81
|
+
'data',
|
|
82
|
+
// #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
|
|
83
|
+
'timeout',
|
|
84
|
+
// #endif
|
|
85
|
+
'dataType',
|
|
86
|
+
// #ifndef MP-ALIPAY
|
|
87
|
+
'responseType',
|
|
88
|
+
// #endif
|
|
89
|
+
// #ifdef APP-PLUS
|
|
90
|
+
'sslVerify',
|
|
91
|
+
// #endif
|
|
92
|
+
// #ifdef H5
|
|
93
|
+
'withCredentials',
|
|
94
|
+
// #endif
|
|
95
|
+
// #ifdef APP-PLUS
|
|
96
|
+
'firstIpv4'
|
|
97
|
+
// #endif
|
|
98
|
+
]
|
|
99
|
+
config = { ...config, ...mergeKeys(defaultsKeys, globalsConfig, config2) }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return config
|
|
103
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve or reject a Promise based on response status.
|
|
3
|
+
*
|
|
4
|
+
* @param {Function} resolve A function that resolves the promise.
|
|
5
|
+
* @param {Function} reject A function that rejects the promise.
|
|
6
|
+
* @param {object} response The response.
|
|
7
|
+
*/
|
|
8
|
+
export default function settle(resolve, reject, response) {
|
|
9
|
+
const { validateStatus } = response.config
|
|
10
|
+
const status = response.statusCode
|
|
11
|
+
if (status && (!validateStatus || validateStatus(status))) {
|
|
12
|
+
resolve(response)
|
|
13
|
+
} else {
|
|
14
|
+
reject(response)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import * as utils from '../utils'
|
|
4
|
+
|
|
5
|
+
function encode(val) {
|
|
6
|
+
return encodeURIComponent(val)
|
|
7
|
+
.replace(/%40/gi, '@')
|
|
8
|
+
.replace(/%3A/gi, ':')
|
|
9
|
+
.replace(/%24/g, '$')
|
|
10
|
+
.replace(/%2C/gi, ',')
|
|
11
|
+
.replace(/%20/g, '+')
|
|
12
|
+
.replace(/%5B/gi, '[')
|
|
13
|
+
.replace(/%5D/gi, ']')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Build a URL by appending params to the end
|
|
18
|
+
*
|
|
19
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
20
|
+
* @param {object} [params] The params to be appended
|
|
21
|
+
* @returns {string} The formatted url
|
|
22
|
+
*/
|
|
23
|
+
export default function buildURL(url, params) {
|
|
24
|
+
/* eslint no-param-reassign:0 */
|
|
25
|
+
if (!params) {
|
|
26
|
+
return url
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let serializedParams
|
|
30
|
+
if (utils.isURLSearchParams(params)) {
|
|
31
|
+
serializedParams = params.toString()
|
|
32
|
+
} else {
|
|
33
|
+
const parts = []
|
|
34
|
+
|
|
35
|
+
utils.forEach(params, (val, key) => {
|
|
36
|
+
if (val === null || typeof val === 'undefined') {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (utils.isArray(val)) {
|
|
41
|
+
key = `${key}[]`
|
|
42
|
+
} else {
|
|
43
|
+
val = [val]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
utils.forEach(val, (v) => {
|
|
47
|
+
if (utils.isDate(v)) {
|
|
48
|
+
v = v.toISOString()
|
|
49
|
+
} else if (utils.isObject(v)) {
|
|
50
|
+
v = JSON.stringify(v)
|
|
51
|
+
}
|
|
52
|
+
parts.push(`${encode(key)}=${encode(v)}`)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
serializedParams = parts.join('&')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (serializedParams) {
|
|
60
|
+
const hashmarkIndex = url.indexOf('#')
|
|
61
|
+
if (hashmarkIndex !== -1) {
|
|
62
|
+
url = url.slice(0, hashmarkIndex)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return url
|
|
69
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new URL by combining the specified URLs
|
|
5
|
+
*
|
|
6
|
+
* @param {string} baseURL The base URL
|
|
7
|
+
* @param {string} relativeURL The relative URL
|
|
8
|
+
* @returns {string} The combined URL
|
|
9
|
+
*/
|
|
10
|
+
export default function combineURLs(baseURL, relativeURL) {
|
|
11
|
+
return relativeURL
|
|
12
|
+
? `${baseURL.replace(/\/+$/, '')}/${relativeURL.replace(/^\/+/, '')}`
|
|
13
|
+
: baseURL
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether the specified URL is absolute
|
|
5
|
+
*
|
|
6
|
+
* @param {string} url The URL to test
|
|
7
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
export default function isAbsoluteURL(url) {
|
|
10
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
11
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
12
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
13
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url)
|
|
14
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
type AnyObject = Record<string | number | symbol, any>
|
|
2
|
+
type HttpPromise<T> = Promise<HttpResponse<T>>;
|
|
3
|
+
type Tasks = UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask
|
|
4
|
+
export interface RequestTask {
|
|
5
|
+
abort: () => void;
|
|
6
|
+
offHeadersReceived: () => void;
|
|
7
|
+
onHeadersReceived: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface HttpRequestConfig<T = Tasks> {
|
|
10
|
+
/** 请求基地址 */
|
|
11
|
+
baseURL?: string;
|
|
12
|
+
/** 请求服务器接口地址 */
|
|
13
|
+
url?: string;
|
|
14
|
+
|
|
15
|
+
/** 请求查询参数,自动拼接为查询字符串 */
|
|
16
|
+
params?: AnyObject;
|
|
17
|
+
/** 请求体参数 */
|
|
18
|
+
data?: AnyObject;
|
|
19
|
+
|
|
20
|
+
/** 文件对应的 key */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** HTTP 请求中其他额外的 form data */
|
|
23
|
+
formData?: AnyObject;
|
|
24
|
+
/** 要上传文件资源的路径。 */
|
|
25
|
+
filePath?: string;
|
|
26
|
+
/** 需要上传的文件列表。使用 files 时,filePath 和 name 不生效,App、H5( 2.6.15+) */
|
|
27
|
+
files?: Array<{
|
|
28
|
+
name?: string;
|
|
29
|
+
file?: File;
|
|
30
|
+
uri: string;
|
|
31
|
+
}>;
|
|
32
|
+
/** 要上传的文件对象,仅H5(2.6.15+)支持 */
|
|
33
|
+
file?: File;
|
|
34
|
+
|
|
35
|
+
/** 请求头信息 */
|
|
36
|
+
header?: AnyObject;
|
|
37
|
+
/** 请求方式 */
|
|
38
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "CONNECT" | "HEAD" | "OPTIONS" | "TRACE" | "UPLOAD" | "DOWNLOAD";
|
|
39
|
+
/** 如果设为 json,会尝试对返回的数据做一次 JSON.parse */
|
|
40
|
+
dataType?: string;
|
|
41
|
+
/** 设置响应的数据类型,支付宝小程序不支持 */
|
|
42
|
+
responseType?: "text" | "arraybuffer";
|
|
43
|
+
/** 自定义参数 */
|
|
44
|
+
custom?: AnyObject;
|
|
45
|
+
/** 超时时间,仅微信小程序(2.10.0)、支付宝小程序支持 */
|
|
46
|
+
timeout?: number;
|
|
47
|
+
/** DNS解析时优先使用ipv4,仅 App-Android 支持 (HBuilderX 2.8.0+) */
|
|
48
|
+
firstIpv4?: boolean;
|
|
49
|
+
/** 验证 ssl 证书 仅5+App安卓端支持(HBuilderX 2.3.3+) */
|
|
50
|
+
sslVerify?: boolean;
|
|
51
|
+
/** 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) */
|
|
52
|
+
withCredentials?: boolean;
|
|
53
|
+
|
|
54
|
+
/** 返回当前请求的task, options。请勿在此处修改options。 */
|
|
55
|
+
getTask?: (task: T, options: HttpRequestConfig<T>) => void;
|
|
56
|
+
/** 全局自定义验证器 */
|
|
57
|
+
validateStatus?: (statusCode: number) => boolean | void;
|
|
58
|
+
}
|
|
59
|
+
export interface HttpResponse<T = any> {
|
|
60
|
+
config: HttpRequestConfig;
|
|
61
|
+
statusCode: number;
|
|
62
|
+
cookies: Array<string>;
|
|
63
|
+
data: T;
|
|
64
|
+
errMsg: string;
|
|
65
|
+
header: AnyObject;
|
|
66
|
+
}
|
|
67
|
+
export interface HttpUploadResponse<T = any> {
|
|
68
|
+
config: HttpRequestConfig;
|
|
69
|
+
statusCode: number;
|
|
70
|
+
data: T;
|
|
71
|
+
errMsg: string;
|
|
72
|
+
}
|
|
73
|
+
export interface HttpDownloadResponse extends HttpResponse {
|
|
74
|
+
tempFilePath: string;
|
|
75
|
+
}
|
|
76
|
+
export interface HttpError {
|
|
77
|
+
config: HttpRequestConfig;
|
|
78
|
+
statusCode?: number;
|
|
79
|
+
cookies?: Array<string>;
|
|
80
|
+
data?: any;
|
|
81
|
+
errMsg: string;
|
|
82
|
+
header?: AnyObject;
|
|
83
|
+
}
|
|
84
|
+
export interface HttpInterceptorManager<V, E = V> {
|
|
85
|
+
use(
|
|
86
|
+
onFulfilled?: (config: V) => Promise<V> | V,
|
|
87
|
+
onRejected?: (config: E) => Promise<E> | E
|
|
88
|
+
): void;
|
|
89
|
+
eject(id: number): void;
|
|
90
|
+
}
|
|
91
|
+
export abstract class HttpRequestAbstract {
|
|
92
|
+
constructor(config?: HttpRequestConfig);
|
|
93
|
+
config: HttpRequestConfig;
|
|
94
|
+
interceptors: {
|
|
95
|
+
request: HttpInterceptorManager<HttpRequestConfig, HttpRequestConfig>;
|
|
96
|
+
response: HttpInterceptorManager<HttpResponse, HttpError>;
|
|
97
|
+
}
|
|
98
|
+
middleware<T = any>(config: HttpRequestConfig): HttpPromise<T>;
|
|
99
|
+
request<T = any>(config: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
100
|
+
get<T = any>(url: string, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
101
|
+
upload<T = any>(url: string, config?: HttpRequestConfig<UniApp.UploadTask>): HttpPromise<T>;
|
|
102
|
+
delete<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
103
|
+
head<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
104
|
+
post<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
105
|
+
put<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
106
|
+
connect<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
107
|
+
options<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
108
|
+
trace<T = any>(url: string, data?: AnyObject, config?: HttpRequestConfig<UniApp.RequestTask>): HttpPromise<T>;
|
|
109
|
+
|
|
110
|
+
download(url: string, config?: HttpRequestConfig<UniApp.DownloadTask>): Promise<HttpDownloadResponse>;
|
|
111
|
+
|
|
112
|
+
setConfig(onSend: (config: HttpRequestConfig) => HttpRequestConfig): void;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare class HttpRequest extends HttpRequestAbstract { }
|
|
116
|
+
export default HttpRequest;
|