uview-plus 3.0.3
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 +64 -0
- package/changelog.md +8 -0
- package/components/u--form/u--form.vue +78 -0
- package/components/u--image/u--image.vue +47 -0
- package/components/u--input/u--input.vue +73 -0
- package/components/u--text/u--text.vue +44 -0
- package/components/u--textarea/u--textarea.vue +48 -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 +172 -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 +490 -0
- package/components/u-button/vue.scss +80 -0
- package/components/u-calendar/header.vue +99 -0
- package/components/u-calendar/month.vue +580 -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 +116 -0
- package/components/u-datetime-picker/u-datetime-picker.vue +362 -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 +146 -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 +43 -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 +234 -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 +354 -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 +84 -0
- package/components/u-modal/u-modal.vue +227 -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 +283 -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 +337 -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 +304 -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 +354 -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/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 +558 -0
- package/components/u-upload/utils.js +151 -0
- package/components/uview-plus/uview-plus.vue +15 -0
- package/index.js +77 -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 +36 -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 +22 -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 +30 -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 +708 -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/emitter.js +51 -0
- package/libs/util/route.js +124 -0
- package/package.json +91 -0
- package/theme.scss +44 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-toast">
|
|
3
|
+
<u-overlay
|
|
4
|
+
:show="isShow"
|
|
5
|
+
:custom-style="overlayStyle"
|
|
6
|
+
>
|
|
7
|
+
<view
|
|
8
|
+
class="u-toast__content"
|
|
9
|
+
:style="[contentStyle]"
|
|
10
|
+
:class="['u-type-' + tmpConfig.type, (tmpConfig.type === 'loading' || tmpConfig.loading) ? 'u-toast__content--loading' : '']"
|
|
11
|
+
>
|
|
12
|
+
<u-loading-icon
|
|
13
|
+
v-if="tmpConfig.type === 'loading'"
|
|
14
|
+
mode="circle"
|
|
15
|
+
color="rgb(255, 255, 255)"
|
|
16
|
+
inactiveColor="rgb(120, 120, 120)"
|
|
17
|
+
size="25"
|
|
18
|
+
></u-loading-icon>
|
|
19
|
+
<u-icon
|
|
20
|
+
v-else-if="tmpConfig.type !== 'defalut' && iconName"
|
|
21
|
+
:name="iconName"
|
|
22
|
+
size="17"
|
|
23
|
+
:color="tmpConfig.type"
|
|
24
|
+
:customStyle="iconStyle"
|
|
25
|
+
></u-icon>
|
|
26
|
+
<u-gap
|
|
27
|
+
v-if="tmpConfig.type === 'loading' || tmpConfig.loading"
|
|
28
|
+
height="12"
|
|
29
|
+
bgColor="transparent"
|
|
30
|
+
></u-gap>
|
|
31
|
+
<text
|
|
32
|
+
class="u-toast__content__text"
|
|
33
|
+
:class="['u-toast__content__text--' + tmpConfig.type]"
|
|
34
|
+
style="max-width: 400rpx;"
|
|
35
|
+
>{{ tmpConfig.message }}</text>
|
|
36
|
+
</view>
|
|
37
|
+
</u-overlay>
|
|
38
|
+
</view>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
/**
|
|
43
|
+
* toast 消息提示
|
|
44
|
+
* @description 此组件表现形式类似uni的uni.showToastAPI,但也有不同的地方。
|
|
45
|
+
* @tutorial https://www.uviewui.com/components/toast.html
|
|
46
|
+
* @property {String | Number} zIndex toast展示时的zIndex值 (默认 10090 )
|
|
47
|
+
* @property {Boolean} loading 是否加载中 (默认 false )
|
|
48
|
+
* @property {String | Number} message 显示的文字内容
|
|
49
|
+
* @property {String} icon 图标,或者绝对路径的图片
|
|
50
|
+
* @property {String} type 主题类型 (默认 default)
|
|
51
|
+
* @property {Boolean} show 是否显示该组件 (默认 false)
|
|
52
|
+
* @property {Boolean} overlay 是否显示透明遮罩,防止点击穿透 (默认 false )
|
|
53
|
+
* @property {String} position 位置 (默认 'center' )
|
|
54
|
+
* @property {Object} params 跳转的参数
|
|
55
|
+
* @property {String | Number} duration 展示时间,单位ms (默认 2000 )
|
|
56
|
+
* @property {Boolean} isTab 是否返回的为tab页面 (默认 false )
|
|
57
|
+
* @property {String} url toast消失后是否跳转页面,有则跳转,优先级高于back参数
|
|
58
|
+
* @property {Function} complete 执行完后的回调函数
|
|
59
|
+
* @property {Boolean} back 结束toast是否自动返回上一页 (默认 false )
|
|
60
|
+
* @property {Object} customStyle 组件的样式,对象形式
|
|
61
|
+
* @event {Function} show 显示toast,如需一进入页面就显示toast,请在onReady生命周期调用
|
|
62
|
+
* @example <u-toast ref="uToast" />
|
|
63
|
+
*/
|
|
64
|
+
export default {
|
|
65
|
+
name: 'u-toast',
|
|
66
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin],
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
isShow: false,
|
|
70
|
+
timer: null, // 定时器
|
|
71
|
+
config: {
|
|
72
|
+
message: '', // 显示文本
|
|
73
|
+
type: '', // 主题类型,primary,success,error,warning,black
|
|
74
|
+
duration: 2000, // 显示的时间,毫秒
|
|
75
|
+
icon: true, // 显示的图标
|
|
76
|
+
position: 'center', // toast出现的位置
|
|
77
|
+
complete: null, // 执行完后的回调函数
|
|
78
|
+
overlay: false, // 是否防止触摸穿透
|
|
79
|
+
loading: false, // 是否加载中状态
|
|
80
|
+
},
|
|
81
|
+
tmpConfig: {}, // 将用户配置和内置配置合并后的临时配置变量
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
computed: {
|
|
85
|
+
iconName() {
|
|
86
|
+
// 只有不为none,并且type为error|warning|succes|info时候,才显示图标
|
|
87
|
+
if(!this.tmpConfig.icon || this.tmpConfig.icon == 'none') {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
|
|
91
|
+
return uni.$u.type2icon(this.tmpConfig.type)
|
|
92
|
+
} else {
|
|
93
|
+
return ''
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
overlayStyle() {
|
|
97
|
+
const style = {
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
display: 'flex'
|
|
101
|
+
}
|
|
102
|
+
// 将遮罩设置为100%透明度,避免出现灰色背景
|
|
103
|
+
style.backgroundColor = 'rgba(0, 0, 0, 0)'
|
|
104
|
+
return style
|
|
105
|
+
},
|
|
106
|
+
iconStyle() {
|
|
107
|
+
const style = {}
|
|
108
|
+
// 图标需要一个右边距,以跟右边的文字有隔开的距离
|
|
109
|
+
style.marginRight = '4px'
|
|
110
|
+
// #ifdef APP-NVUE
|
|
111
|
+
// iOSAPP下,图标有1px的向下偏移,这里进行修正
|
|
112
|
+
if (uni.$u.os() === 'ios') {
|
|
113
|
+
style.marginTop = '-1px'
|
|
114
|
+
}
|
|
115
|
+
// #endif
|
|
116
|
+
return style
|
|
117
|
+
},
|
|
118
|
+
loadingIconColor() {
|
|
119
|
+
let color = 'rgb(255, 255, 255)'
|
|
120
|
+
if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
|
|
121
|
+
// loading-icon组件内部会对color参数进行一个透明度处理,该方法要求传入的颜色值
|
|
122
|
+
// 必须为rgb格式的,所以这里做一个处理
|
|
123
|
+
color = uni.$u.hexToRgb(uni.$u.color[this.tmpConfig.type])
|
|
124
|
+
}
|
|
125
|
+
return color
|
|
126
|
+
},
|
|
127
|
+
// 内容盒子的样式
|
|
128
|
+
contentStyle() {
|
|
129
|
+
const windowHeight = uni.$u.sys().windowHeight, style = {}
|
|
130
|
+
let value = 0
|
|
131
|
+
// 根据top和bottom,对Y轴进行窗体高度的百分比偏移
|
|
132
|
+
if(this.tmpConfig.position === 'top') {
|
|
133
|
+
value = - windowHeight * 0.25
|
|
134
|
+
} else if(this.tmpConfig.position === 'bottom') {
|
|
135
|
+
value = windowHeight * 0.25
|
|
136
|
+
}
|
|
137
|
+
style.transform = `translateY(${value}px)`
|
|
138
|
+
return style
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
created() {
|
|
142
|
+
// 通过主题的形式调用toast,批量生成方法函数
|
|
143
|
+
['primary', 'success', 'error', 'warning', 'default', 'loading'].map(item => {
|
|
144
|
+
this[item] = message => this.show({
|
|
145
|
+
type: item,
|
|
146
|
+
message
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
methods: {
|
|
151
|
+
// 显示toast组件,由父组件通过this.$refs.xxx.show(options)形式调用
|
|
152
|
+
show(options) {
|
|
153
|
+
// 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
|
|
154
|
+
this.tmpConfig = uni.$u.deepMerge(this.config, options)
|
|
155
|
+
// 清除定时器
|
|
156
|
+
this.clearTimer()
|
|
157
|
+
this.isShow = true
|
|
158
|
+
this.timer = setTimeout(() => {
|
|
159
|
+
// 倒计时结束,清除定时器,隐藏toast组件
|
|
160
|
+
this.clearTimer()
|
|
161
|
+
// 判断是否存在callback方法,如果存在就执行
|
|
162
|
+
typeof(this.tmpConfig.complete) === 'function' && this.tmpConfig.complete()
|
|
163
|
+
}, this.tmpConfig.duration)
|
|
164
|
+
},
|
|
165
|
+
// 隐藏toast组件,由父组件通过this.$refs.xxx.hide()形式调用
|
|
166
|
+
hide() {
|
|
167
|
+
this.clearTimer()
|
|
168
|
+
},
|
|
169
|
+
clearTimer() {
|
|
170
|
+
this.isShow = false
|
|
171
|
+
// 清除定时器
|
|
172
|
+
clearTimeout(this.timer)
|
|
173
|
+
this.timer = null
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
beforeDestroy() {
|
|
177
|
+
this.clearTimer()
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<style lang="scss" scoped>
|
|
183
|
+
@import "../../libs/css/components.scss";
|
|
184
|
+
|
|
185
|
+
$u-toast-color:#fff !default;
|
|
186
|
+
$u-toast-border-radius:4px !default;
|
|
187
|
+
$u-toast-border-background-color:#585858 !default;
|
|
188
|
+
$u-toast-border-font-size:14px !default;
|
|
189
|
+
$u-toast-border-padding:12px 20px !default;
|
|
190
|
+
$u-toast-loading-border-padding: 20px 20px !default;
|
|
191
|
+
$u-toast-content-text-color:#fff !default;
|
|
192
|
+
$u-toast-content-text-font-size:15px !default;
|
|
193
|
+
$u-toast-u-icon:10rpx !default;
|
|
194
|
+
$u-toast-u-type-primary-color:$u-primary !default;
|
|
195
|
+
$u-toast-u-type-primary-background-color:#ecf5ff !default;
|
|
196
|
+
$u-toast-u-type-primary-border-color:rgb(215, 234, 254) !default;
|
|
197
|
+
$u-toast-u-type-primary-border-width:1px !default;
|
|
198
|
+
$u-toast-u-type-success-color: $u-success !default;
|
|
199
|
+
$u-toast-u-type-success-background-color: #dbf1e1 !default;
|
|
200
|
+
$u-toast-u-type-success-border-color: #BEF5C8 !default;
|
|
201
|
+
$u-toast-u-type-success-border-width: 1px !default;
|
|
202
|
+
$u-toast-u-type-error-color:$u-error !default;
|
|
203
|
+
$u-toast-u-type-error-background-color:#fef0f0 !default;
|
|
204
|
+
$u-toast-u-type-error-border-color:#fde2e2 !default;
|
|
205
|
+
$u-toast-u-type-error-border-width: 1px !default;
|
|
206
|
+
$u-toast-u-type-warning-color:$u-warning !default;
|
|
207
|
+
$u-toast-u-type-warning-background-color:#fdf6ec !default;
|
|
208
|
+
$u-toast-u-type-warning-border-color:#faecd8 !default;
|
|
209
|
+
$u-toast-u-type-warning-border-width: 1px !default;
|
|
210
|
+
$u-toast-u-type-default-color:#fff !default;
|
|
211
|
+
$u-toast-u-type-default-background-color:#585858 !default;
|
|
212
|
+
|
|
213
|
+
.u-toast {
|
|
214
|
+
&__content {
|
|
215
|
+
@include flex;
|
|
216
|
+
padding: $u-toast-border-padding;
|
|
217
|
+
border-radius: $u-toast-border-radius;
|
|
218
|
+
background-color: $u-toast-border-background-color;
|
|
219
|
+
color: $u-toast-color;
|
|
220
|
+
align-items: center;
|
|
221
|
+
/* #ifndef APP-NVUE */
|
|
222
|
+
max-width: 600rpx;
|
|
223
|
+
/* #endif */
|
|
224
|
+
position: relative;
|
|
225
|
+
|
|
226
|
+
&--loading {
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
padding: $u-toast-loading-border-padding;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&__text {
|
|
232
|
+
color: $u-toast-content-text-color;
|
|
233
|
+
font-size: $u-toast-content-text-font-size;
|
|
234
|
+
line-height: $u-toast-content-text-font-size;
|
|
235
|
+
|
|
236
|
+
&--default {
|
|
237
|
+
color: $u-toast-content-text-color;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&--error {
|
|
241
|
+
color: $u-error;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&--primary {
|
|
245
|
+
color: $u-primary;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&--success {
|
|
249
|
+
color: $u-success;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&--warning {
|
|
253
|
+
color: $u-warning;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.u-type-primary {
|
|
260
|
+
color: $u-toast-u-type-primary-color;
|
|
261
|
+
background-color: $u-toast-u-type-primary-background-color;
|
|
262
|
+
border-color: $u-toast-u-type-primary-border-color;
|
|
263
|
+
border-width: $u-toast-u-type-primary-border-width;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.u-type-success {
|
|
267
|
+
color: $u-toast-u-type-success-color;
|
|
268
|
+
background-color: $u-toast-u-type-success-background-color;
|
|
269
|
+
border-color: $u-toast-u-type-success-border-color;
|
|
270
|
+
border-width: 1px;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.u-type-error {
|
|
274
|
+
color: $u-toast-u-type-error-color;
|
|
275
|
+
background-color: $u-toast-u-type-error-background-color;
|
|
276
|
+
border-color: $u-toast-u-type-error-border-color;
|
|
277
|
+
border-width: $u-toast-u-type-error-border-width;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.u-type-warning {
|
|
281
|
+
color: $u-toast-u-type-warning-color;
|
|
282
|
+
background-color: $u-toast-u-type-warning-background-color;
|
|
283
|
+
border-color: $u-toast-u-type-warning-border-color;
|
|
284
|
+
border-width: 1px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.u-type-default {
|
|
288
|
+
color: $u-toast-u-type-default-color;
|
|
289
|
+
background-color: $u-toast-u-type-default-background-color;
|
|
290
|
+
}
|
|
291
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否展示工具条
|
|
4
|
+
show: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: uni.$u.props.toolbar.show
|
|
7
|
+
},
|
|
8
|
+
// 取消按钮的文字
|
|
9
|
+
cancelText: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: uni.$u.props.toolbar.cancelText
|
|
12
|
+
},
|
|
13
|
+
// 确认按钮的文字
|
|
14
|
+
confirmText: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: uni.$u.props.toolbar.confirmText
|
|
17
|
+
},
|
|
18
|
+
// 取消按钮的颜色
|
|
19
|
+
cancelColor: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: uni.$u.props.toolbar.cancelColor
|
|
22
|
+
},
|
|
23
|
+
// 确认按钮的颜色
|
|
24
|
+
confirmColor: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: uni.$u.props.toolbar.confirmColor
|
|
27
|
+
},
|
|
28
|
+
// 标题文字
|
|
29
|
+
title: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: uni.$u.props.toolbar.title
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-toolbar"
|
|
4
|
+
@touchmove.stop.prevent="noop"
|
|
5
|
+
v-if="show"
|
|
6
|
+
>
|
|
7
|
+
<view
|
|
8
|
+
class="u-toolbar__cancel__wrapper"
|
|
9
|
+
hover-class="u-hover-class"
|
|
10
|
+
>
|
|
11
|
+
<text
|
|
12
|
+
class="u-toolbar__wrapper__cancel"
|
|
13
|
+
@tap="cancel"
|
|
14
|
+
:style="{
|
|
15
|
+
color: cancelColor
|
|
16
|
+
}"
|
|
17
|
+
>{{ cancelText }}</text>
|
|
18
|
+
</view>
|
|
19
|
+
<text
|
|
20
|
+
class="u-toolbar__title u-line-1"
|
|
21
|
+
v-if="title"
|
|
22
|
+
>{{ title }}</text>
|
|
23
|
+
<view
|
|
24
|
+
class="u-toolbar__confirm__wrapper"
|
|
25
|
+
hover-class="u-hover-class"
|
|
26
|
+
>
|
|
27
|
+
<text
|
|
28
|
+
class="u-toolbar__wrapper__confirm"
|
|
29
|
+
@tap="confirm"
|
|
30
|
+
:style="{
|
|
31
|
+
color: confirmColor
|
|
32
|
+
}"
|
|
33
|
+
>{{ confirmText }}</text>
|
|
34
|
+
</view>
|
|
35
|
+
</view>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import props from './props.js';
|
|
40
|
+
/**
|
|
41
|
+
* Toolbar 工具条
|
|
42
|
+
* @description
|
|
43
|
+
* @tutorial https://www.uviewui.com/components/toolbar.html
|
|
44
|
+
* @property {Boolean} show 是否展示工具条(默认 true )
|
|
45
|
+
* @property {String} cancelText 取消按钮的文字(默认 '取消' )
|
|
46
|
+
* @property {String} confirmText 确认按钮的文字(默认 '确认' )
|
|
47
|
+
* @property {String} cancelColor 取消按钮的颜色(默认 '#909193' )
|
|
48
|
+
* @property {String} confirmColor 确认按钮的颜色(默认 '#3c9cff' )
|
|
49
|
+
* @property {String} title 标题文字
|
|
50
|
+
* @event {Function}
|
|
51
|
+
* @example
|
|
52
|
+
*/
|
|
53
|
+
export default {
|
|
54
|
+
name: 'u-toolbar',
|
|
55
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
|
|
56
|
+
methods: {
|
|
57
|
+
// 点击取消按钮
|
|
58
|
+
cancel() {
|
|
59
|
+
this.$emit('cancel')
|
|
60
|
+
},
|
|
61
|
+
// 点击确定按钮
|
|
62
|
+
confirm() {
|
|
63
|
+
this.$emit('confirm')
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style lang="scss" scoped>
|
|
70
|
+
@import "../../libs/css/components.scss";
|
|
71
|
+
|
|
72
|
+
.u-toolbar {
|
|
73
|
+
height: 42px;
|
|
74
|
+
@include flex;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
align-items: center;
|
|
77
|
+
|
|
78
|
+
&__wrapper {
|
|
79
|
+
&__cancel {
|
|
80
|
+
color: $u-tips-color;
|
|
81
|
+
font-size: 15px;
|
|
82
|
+
padding: 0 15px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__title {
|
|
87
|
+
color: $u-main-color;
|
|
88
|
+
padding: 0 60rpx;
|
|
89
|
+
font-size: 16px;
|
|
90
|
+
flex: 1;
|
|
91
|
+
text-align: center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__wrapper {
|
|
95
|
+
&__confirm {
|
|
96
|
+
color: $u-primary;
|
|
97
|
+
font-size: 15px;
|
|
98
|
+
padding: 0 15px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 需要显示的提示文字
|
|
4
|
+
text: {
|
|
5
|
+
type: [String, Number],
|
|
6
|
+
default: uni.$u.props.tooltip.text
|
|
7
|
+
},
|
|
8
|
+
// 点击复制按钮时,复制的文本,为空则使用text值
|
|
9
|
+
copyText: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
default: uni.$u.props.tooltip.copyText
|
|
12
|
+
},
|
|
13
|
+
// 文本大小
|
|
14
|
+
size: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: uni.$u.props.tooltip.size
|
|
17
|
+
},
|
|
18
|
+
// 字体颜色
|
|
19
|
+
color: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: uni.$u.props.tooltip.color
|
|
22
|
+
},
|
|
23
|
+
// 弹出提示框时,文本的背景色
|
|
24
|
+
bgColor: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: uni.$u.props.tooltip.bgColor
|
|
27
|
+
},
|
|
28
|
+
// 弹出提示的方向,top-上方,bottom-下方
|
|
29
|
+
direction: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: uni.$u.props.tooltip.direction
|
|
32
|
+
},
|
|
33
|
+
// 弹出提示的z-index,nvue无效
|
|
34
|
+
zIndex: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: uni.$u.props.tooltip.zIndex
|
|
37
|
+
},
|
|
38
|
+
// 是否显示复制按钮
|
|
39
|
+
showCopy: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: uni.$u.props.tooltip.showCopy
|
|
42
|
+
},
|
|
43
|
+
// 扩展的按钮组
|
|
44
|
+
buttons: {
|
|
45
|
+
type: Array,
|
|
46
|
+
default: uni.$u.props.tooltip.buttons
|
|
47
|
+
},
|
|
48
|
+
// 是否显示透明遮罩以防止触摸穿透
|
|
49
|
+
overlay: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: uni.$u.props.tooltip.overlay
|
|
52
|
+
},
|
|
53
|
+
// 是否显示复制成功或者失败的toast
|
|
54
|
+
showToast: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: uni.$u.props.tooltip.showToast
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|