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,224 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-scroll-list"
|
|
4
|
+
ref="u-scroll-list"
|
|
5
|
+
>
|
|
6
|
+
<!-- #ifdef APP-NVUE -->
|
|
7
|
+
<!-- nvue使用bindingX实现,以得到更好的性能 -->
|
|
8
|
+
<scroller
|
|
9
|
+
class="u-scroll-list__scroll-view"
|
|
10
|
+
ref="u-scroll-list__scroll-view"
|
|
11
|
+
scroll-direction="horizontal"
|
|
12
|
+
:show-scrollbar="false"
|
|
13
|
+
:offset-accuracy="1"
|
|
14
|
+
@scroll="nvueScrollHandler"
|
|
15
|
+
>
|
|
16
|
+
<view class="u-scroll-list__scroll-view__content">
|
|
17
|
+
<slot />
|
|
18
|
+
</view>
|
|
19
|
+
</scroller>
|
|
20
|
+
<!-- #endif -->
|
|
21
|
+
<!-- #ifndef APP-NVUE -->
|
|
22
|
+
<!-- #ifdef MP-WEIXIN || APP-VUE || H5 || MP-QQ -->
|
|
23
|
+
<!-- 以上平台,支持wxs -->
|
|
24
|
+
<scroll-view
|
|
25
|
+
class="u-scroll-list__scroll-view"
|
|
26
|
+
scroll-x
|
|
27
|
+
@scroll="wxs.scroll"
|
|
28
|
+
@scrolltoupper="wxs.scrolltoupper"
|
|
29
|
+
@scrolltolower="wxs.scrolltolower"
|
|
30
|
+
:data-scrollWidth="scrollWidth"
|
|
31
|
+
:data-barWidth="$u.getPx(indicatorBarWidth)"
|
|
32
|
+
:data-indicatorWidth="$u.getPx(indicatorWidth)"
|
|
33
|
+
:show-scrollbar="false"
|
|
34
|
+
:upper-threshold="0"
|
|
35
|
+
:lower-threshold="0"
|
|
36
|
+
>
|
|
37
|
+
<!-- #endif -->
|
|
38
|
+
<!-- #ifndef APP-NVUE || MP-WEIXIN || H5 || APP-VUE || MP-QQ -->
|
|
39
|
+
<!-- 非以上平台,只能使用普通js实现 -->
|
|
40
|
+
<scroll-view
|
|
41
|
+
class="u-scroll-list__scroll-view"
|
|
42
|
+
scroll-x
|
|
43
|
+
@scroll="scrollHandler"
|
|
44
|
+
@scrolltoupper="scrolltoupperHandler"
|
|
45
|
+
@scrolltolower="scrolltolowerHandler"
|
|
46
|
+
:show-scrollbar="false"
|
|
47
|
+
:upper-threshold="0"
|
|
48
|
+
:lower-threshold="0"
|
|
49
|
+
>
|
|
50
|
+
<!-- #endif -->
|
|
51
|
+
<view class="u-scroll-list__scroll-view__content">
|
|
52
|
+
<slot />
|
|
53
|
+
</view>
|
|
54
|
+
</scroll-view>
|
|
55
|
+
<!-- #endif -->
|
|
56
|
+
<view
|
|
57
|
+
class="u-scroll-list__indicator"
|
|
58
|
+
v-if="indicator"
|
|
59
|
+
:style="[$u.addStyle(indicatorStyle)]"
|
|
60
|
+
>
|
|
61
|
+
<view
|
|
62
|
+
class="u-scroll-list__indicator__line"
|
|
63
|
+
:style="[lineStyle]"
|
|
64
|
+
>
|
|
65
|
+
<view
|
|
66
|
+
class="u-scroll-list__indicator__line__bar"
|
|
67
|
+
:style="[barStyle]"
|
|
68
|
+
ref="u-scroll-list__indicator__line__bar"
|
|
69
|
+
></view>
|
|
70
|
+
</view>
|
|
71
|
+
</view>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script
|
|
76
|
+
src="./scrollWxs.wxs"
|
|
77
|
+
module="wxs"
|
|
78
|
+
lang="wxs"
|
|
79
|
+
></script>
|
|
80
|
+
|
|
81
|
+
<script>
|
|
82
|
+
/**
|
|
83
|
+
* scrollList 横向滚动列表
|
|
84
|
+
* @description 该组件一般用于同时展示多个商品、分类的场景,也可以完成左右滑动的列表。
|
|
85
|
+
* @tutorial https://www.uviewui.com/components/scrollList.html
|
|
86
|
+
* @property {String | Number} indicatorWidth 指示器的整体宽度 (默认 50 )
|
|
87
|
+
* @property {String | Number} indicatorBarWidth 滑块的宽度 (默认 20 )
|
|
88
|
+
* @property {Boolean} indicator 是否显示面板指示器 (默认 true )
|
|
89
|
+
* @property {String} indicatorColor 指示器非激活颜色 (默认 '#f2f2f2' )
|
|
90
|
+
* @property {String} indicatorActiveColor 指示器的激活颜色 (默认 '#3c9cff' )
|
|
91
|
+
* @property {String | Object} indicatorStyle 指示器样式,可通过bottom,left,right进行定位
|
|
92
|
+
* @event {Function} left 滑动到左边时触发
|
|
93
|
+
* @event {Function} right 滑动到右边时触发
|
|
94
|
+
* @example
|
|
95
|
+
*/
|
|
96
|
+
// #ifdef APP-NVUE
|
|
97
|
+
const dom = uni.requireNativePlugin('dom')
|
|
98
|
+
import nvueMixin from "./nvue.js"
|
|
99
|
+
// #endif
|
|
100
|
+
import props from './props.js';
|
|
101
|
+
export default {
|
|
102
|
+
name: 'u-scroll-list',
|
|
103
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
104
|
+
// #ifdef APP-NVUE
|
|
105
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, nvueMixin, props],
|
|
106
|
+
// #endif
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
scrollInfo: {
|
|
110
|
+
scrollLeft: 0,
|
|
111
|
+
scrollWidth: 0
|
|
112
|
+
},
|
|
113
|
+
scrollWidth: 0
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
computed: {
|
|
117
|
+
// 指示器为线型的样式
|
|
118
|
+
barStyle() {
|
|
119
|
+
const style = {}
|
|
120
|
+
// #ifndef APP-NVUE || MP-WEIXIN || H5 || APP-VUE || MP-QQ
|
|
121
|
+
// 此为普通js方案,只有在非nvue和不支持wxs方案的端才使用、
|
|
122
|
+
// 此处的计算理由为:scroll-view的滚动距离与目标滚动距离(scroll-view的实际宽度减去包裹元素的宽度)之比,等于滑块当前移动距离与总需
|
|
123
|
+
// 滑动距离(指示器的总宽度减去滑块宽度)的比值
|
|
124
|
+
const scrollLeft = this.scrollInfo.scrollLeft,
|
|
125
|
+
scrollWidth = this.scrollInfo.scrollWidth,
|
|
126
|
+
barAllMoveWidth = this.indicatorWidth - this.indicatorBarWidth
|
|
127
|
+
const x = scrollLeft / (scrollWidth - this.scrollWidth) * barAllMoveWidth
|
|
128
|
+
style.transform = `translateX(${ x }px)`
|
|
129
|
+
// #endif
|
|
130
|
+
// 设置滑块的宽度和背景色,是每个平台都需要的
|
|
131
|
+
style.width = uni.$u.addUnit(this.indicatorBarWidth)
|
|
132
|
+
style.backgroundColor = this.indicatorActiveColor
|
|
133
|
+
return style
|
|
134
|
+
},
|
|
135
|
+
lineStyle() {
|
|
136
|
+
const style = {}
|
|
137
|
+
// 指示器整体的样式,需要设置其宽度和背景色
|
|
138
|
+
style.width = uni.$u.addUnit(this.indicatorWidth)
|
|
139
|
+
style.backgroundColor = this.indicatorColor
|
|
140
|
+
return style
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
mounted() {
|
|
144
|
+
this.init()
|
|
145
|
+
},
|
|
146
|
+
methods: {
|
|
147
|
+
init() {
|
|
148
|
+
this.getComponentWidth()
|
|
149
|
+
},
|
|
150
|
+
// #ifndef APP-NVUE || MP-WEIXIN || H5 || APP-VUE || MP-QQ
|
|
151
|
+
// scroll-view触发滚动事件
|
|
152
|
+
scrollHandler(e) {
|
|
153
|
+
this.scrollInfo = e.detail
|
|
154
|
+
},
|
|
155
|
+
scrolltoupperHandler() {
|
|
156
|
+
this.scrollEvent('left')
|
|
157
|
+
this.scrollInfo.scrollLeft = 0
|
|
158
|
+
},
|
|
159
|
+
scrolltolowerHandler() {
|
|
160
|
+
this.scrollEvent('right')
|
|
161
|
+
// 在普通js方案中,滚动到右边时,通过设置this.scrollInfo,模拟出滚动到右边的情况
|
|
162
|
+
// 因为上方是用过computed计算的,设置后,会自动调整滑块的位置
|
|
163
|
+
this.scrollInfo.scrollLeft = uni.$u.getPx(this.indicatorWidth) - uni.$u.getPx(this.indicatorBarWidth)
|
|
164
|
+
},
|
|
165
|
+
// #endif
|
|
166
|
+
//
|
|
167
|
+
scrollEvent(status) {
|
|
168
|
+
this.$emit(status)
|
|
169
|
+
},
|
|
170
|
+
// 获取组件的宽度
|
|
171
|
+
async getComponentWidth() {
|
|
172
|
+
// 延时一定时间,以获取dom尺寸
|
|
173
|
+
await uni.$u.sleep(30)
|
|
174
|
+
// #ifndef APP-NVUE
|
|
175
|
+
this.$uGetRect('.u-scroll-list').then(size => {
|
|
176
|
+
this.scrollWidth = size.width
|
|
177
|
+
})
|
|
178
|
+
// #endif
|
|
179
|
+
|
|
180
|
+
// #ifdef APP-NVUE
|
|
181
|
+
const ref = this.$refs['u-scroll-list']
|
|
182
|
+
ref && dom.getComponentRect(ref, (res) => {
|
|
183
|
+
this.scrollWidth = res.size.width
|
|
184
|
+
})
|
|
185
|
+
// #endif
|
|
186
|
+
},
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<style lang="scss" scoped>
|
|
192
|
+
@import "../../libs/css/components.scss";
|
|
193
|
+
|
|
194
|
+
.u-scroll-list {
|
|
195
|
+
padding-bottom: 10px;
|
|
196
|
+
|
|
197
|
+
&__scroll-view {
|
|
198
|
+
@include flex;
|
|
199
|
+
|
|
200
|
+
&__content {
|
|
201
|
+
@include flex;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&__indicator {
|
|
206
|
+
@include flex;
|
|
207
|
+
justify-content: center;
|
|
208
|
+
margin-top: 15px;
|
|
209
|
+
|
|
210
|
+
&__line {
|
|
211
|
+
width: 60px;
|
|
212
|
+
height: 4px;
|
|
213
|
+
border-radius: 100px;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
|
|
216
|
+
&__bar {
|
|
217
|
+
width: 20px;
|
|
218
|
+
height: 4px;
|
|
219
|
+
border-radius: 100px;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
</style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 搜索框形状,round-圆形,square-方形
|
|
4
|
+
shape: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: uni.$u.props.search.shape
|
|
7
|
+
},
|
|
8
|
+
// 搜索框背景色,默认值#f2f2f2
|
|
9
|
+
bgColor: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: uni.$u.props.search.bgColor
|
|
12
|
+
},
|
|
13
|
+
// 占位提示文字
|
|
14
|
+
placeholder: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: uni.$u.props.search.placeholder
|
|
17
|
+
},
|
|
18
|
+
// 是否启用清除控件
|
|
19
|
+
clearabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: uni.$u.props.search.clearabled
|
|
22
|
+
},
|
|
23
|
+
// 是否自动聚焦
|
|
24
|
+
focus: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: uni.$u.props.search.focus
|
|
27
|
+
},
|
|
28
|
+
// 是否在搜索框右侧显示取消按钮
|
|
29
|
+
showAction: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: uni.$u.props.search.showAction
|
|
32
|
+
},
|
|
33
|
+
// 右边控件的样式
|
|
34
|
+
actionStyle: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default: uni.$u.props.search.actionStyle
|
|
37
|
+
},
|
|
38
|
+
// 取消按钮文字
|
|
39
|
+
actionText: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: uni.$u.props.search.actionText
|
|
42
|
+
},
|
|
43
|
+
// 输入框内容对齐方式,可选值为 left|center|right
|
|
44
|
+
inputAlign: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: uni.$u.props.search.inputAlign
|
|
47
|
+
},
|
|
48
|
+
// input输入框的样式,可以定义文字颜色,大小等,对象形式
|
|
49
|
+
inputStyle: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: uni.$u.props.search.inputStyle
|
|
52
|
+
},
|
|
53
|
+
// 是否启用输入框
|
|
54
|
+
disabled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: uni.$u.props.search.disabled
|
|
57
|
+
},
|
|
58
|
+
// 边框颜色
|
|
59
|
+
borderColor: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: uni.$u.props.search.borderColor
|
|
62
|
+
},
|
|
63
|
+
// 搜索图标的颜色,默认同输入框字体颜色
|
|
64
|
+
searchIconColor: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: uni.$u.props.search.searchIconColor
|
|
67
|
+
},
|
|
68
|
+
// 输入框字体颜色
|
|
69
|
+
color: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: uni.$u.props.search.color
|
|
72
|
+
},
|
|
73
|
+
// placeholder的颜色
|
|
74
|
+
placeholderColor: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: uni.$u.props.search.placeholderColor
|
|
77
|
+
},
|
|
78
|
+
// 左边输入框的图标,可以为uView图标名称或图片路径
|
|
79
|
+
searchIcon: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: uni.$u.props.search.searchIcon
|
|
82
|
+
},
|
|
83
|
+
searchIconSize: {
|
|
84
|
+
type: [Number, String],
|
|
85
|
+
default: uni.$u.props.search.searchIconSize
|
|
86
|
+
},
|
|
87
|
+
// 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30px"、"30px 20px"等写法
|
|
88
|
+
margin: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: uni.$u.props.search.margin
|
|
91
|
+
},
|
|
92
|
+
// 开启showAction时,是否在input获取焦点时才显示
|
|
93
|
+
animation: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: uni.$u.props.search.animation
|
|
96
|
+
},
|
|
97
|
+
// 输入框的初始化内容
|
|
98
|
+
value: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: uni.$u.props.search.value
|
|
101
|
+
},
|
|
102
|
+
// 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档)
|
|
103
|
+
maxlength: {
|
|
104
|
+
type: [String, Number],
|
|
105
|
+
default: uni.$u.props.search.maxlength
|
|
106
|
+
},
|
|
107
|
+
// 搜索框高度,单位px
|
|
108
|
+
height: {
|
|
109
|
+
type: [String, Number],
|
|
110
|
+
default: uni.$u.props.search.height
|
|
111
|
+
},
|
|
112
|
+
// 搜索框左侧文本
|
|
113
|
+
label: {
|
|
114
|
+
type: [String, Number, null],
|
|
115
|
+
default: uni.$u.props.search.label
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-search"
|
|
4
|
+
@tap="clickHandler"
|
|
5
|
+
:style="[{
|
|
6
|
+
margin: margin,
|
|
7
|
+
}, $u.addStyle(customStyle)]"
|
|
8
|
+
>
|
|
9
|
+
<view
|
|
10
|
+
class="u-search__content"
|
|
11
|
+
:style="{
|
|
12
|
+
backgroundColor: bgColor,
|
|
13
|
+
borderRadius: shape == 'round' ? '100px' : '4px',
|
|
14
|
+
borderColor: borderColor,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<template v-if="$slots.label || label !== null">
|
|
18
|
+
<slot name="label">
|
|
19
|
+
<text class="u-search__content__label">{{ label }}</text>
|
|
20
|
+
</slot>
|
|
21
|
+
</template>
|
|
22
|
+
<view class="u-search__content__icon">
|
|
23
|
+
<u-icon
|
|
24
|
+
@tap="clickIcon"
|
|
25
|
+
:size="searchIconSize"
|
|
26
|
+
:name="searchIcon"
|
|
27
|
+
:color="searchIconColor ? searchIconColor : color"
|
|
28
|
+
></u-icon>
|
|
29
|
+
</view>
|
|
30
|
+
<input
|
|
31
|
+
confirm-type="search"
|
|
32
|
+
@blur="blur"
|
|
33
|
+
:value="value"
|
|
34
|
+
@confirm="search"
|
|
35
|
+
@input="inputChange"
|
|
36
|
+
:disabled="disabled"
|
|
37
|
+
@focus="getFocus"
|
|
38
|
+
:focus="focus"
|
|
39
|
+
:maxlength="maxlength"
|
|
40
|
+
placeholder-class="u-search__content__input--placeholder"
|
|
41
|
+
:placeholder="placeholder"
|
|
42
|
+
:placeholder-style="`color: ${placeholderColor}`"
|
|
43
|
+
class="u-search__content__input"
|
|
44
|
+
type="text"
|
|
45
|
+
:style="[{
|
|
46
|
+
textAlign: inputAlign,
|
|
47
|
+
color: color,
|
|
48
|
+
backgroundColor: bgColor,
|
|
49
|
+
height: $u.addUnit(height)
|
|
50
|
+
}, inputStyle]"
|
|
51
|
+
/>
|
|
52
|
+
<view
|
|
53
|
+
class="u-search__content__icon u-search__content__close"
|
|
54
|
+
v-if="keyword && clearabled && focused"
|
|
55
|
+
@tap="clear"
|
|
56
|
+
>
|
|
57
|
+
<u-icon
|
|
58
|
+
name="close"
|
|
59
|
+
size="11"
|
|
60
|
+
color="#ffffff"
|
|
61
|
+
customStyle="line-height: 12px"
|
|
62
|
+
></u-icon>
|
|
63
|
+
</view>
|
|
64
|
+
</view>
|
|
65
|
+
<text
|
|
66
|
+
:style="[actionStyle]"
|
|
67
|
+
class="u-search__action"
|
|
68
|
+
:class="[(showActionBtn || show) && 'u-search__action--active']"
|
|
69
|
+
@tap.stop.prevent="custom"
|
|
70
|
+
>{{ actionText }}</text>
|
|
71
|
+
</view>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script>
|
|
75
|
+
import props from './props.js';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* search 搜索框
|
|
79
|
+
* @description 搜索组件,集成了常见搜索框所需功能,用户可以一键引入,开箱即用。
|
|
80
|
+
* @tutorial https://www.uviewui.com/components/search.html
|
|
81
|
+
* @property {String} shape 搜索框形状,round-圆形,square-方形(默认 'round' )
|
|
82
|
+
* @property {String} bgColor 搜索框背景颜色(默认 '#f2f2f2' )
|
|
83
|
+
* @property {String} placeholder 占位文字内容(默认 '请输入关键字' )
|
|
84
|
+
* @property {Boolean} clearabled 是否启用清除控件(默认 true )
|
|
85
|
+
* @property {Boolean} focus 是否自动获得焦点(默认 false )
|
|
86
|
+
* @property {Boolean} showAction 是否显示右侧控件(默认 true )
|
|
87
|
+
* @property {Object} actionStyle 右侧控件的样式,对象形式
|
|
88
|
+
* @property {String} actionText 右侧控件文字(默认 '搜索' )
|
|
89
|
+
* @property {String} inputAlign 输入框内容水平对齐方式 (默认 'left' )
|
|
90
|
+
* @property {Object} inputStyle 自定义输入框样式,对象形式
|
|
91
|
+
* @property {Boolean} disabled 是否启用输入框(默认 false )
|
|
92
|
+
* @property {String} borderColor 边框颜色,配置了颜色,才会有边框 (默认 'transparent' )
|
|
93
|
+
* @property {String} searchIconColor 搜索图标的颜色,默认同输入框字体颜色 (默认 '#909399' )
|
|
94
|
+
* @property {Number | String} searchIconSize 搜索图标的字体,默认22
|
|
95
|
+
* @property {String} color 输入框字体颜色(默认 '#606266' )
|
|
96
|
+
* @property {String} placeholderColor placeholder的颜色(默认 '#909399' )
|
|
97
|
+
* @property {String} searchIcon 输入框左边的图标,可以为uView图标名称或图片路径 (默认 'search' )
|
|
98
|
+
* @property {String} margin 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30px" (默认 '0' )
|
|
99
|
+
* @property {Boolean} animation 是否开启动画,见上方说明(默认 false )
|
|
100
|
+
* @property {String} value 输入框初始值
|
|
101
|
+
* @property {String | Number} maxlength 输入框最大能输入的长度,-1为不限制长度 (默认 '-1' )
|
|
102
|
+
* @property {String | Number} height 输入框高度,单位px(默认 64 )
|
|
103
|
+
* @property {String | Number} label 搜索框左边显示内容
|
|
104
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
105
|
+
*
|
|
106
|
+
* @event {Function} change 输入框内容发生变化时触发
|
|
107
|
+
* @event {Function} search 用户确定搜索时触发,用户按回车键,或者手机键盘右下角的"搜索"键时触发
|
|
108
|
+
* @event {Function} custom 用户点击右侧控件时触发
|
|
109
|
+
* @event {Function} clear 用户点击清除按钮时触发
|
|
110
|
+
* @example <u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
|
|
111
|
+
*/
|
|
112
|
+
export default {
|
|
113
|
+
name: "u-search",
|
|
114
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
|
|
115
|
+
data() {
|
|
116
|
+
return {
|
|
117
|
+
keyword: '',
|
|
118
|
+
showClear: false, // 是否显示右边的清除图标
|
|
119
|
+
show: false,
|
|
120
|
+
// 标记input当前状态是否处于聚焦中,如果是,才会显示右侧的清除控件
|
|
121
|
+
focused: this.focus
|
|
122
|
+
// 绑定输入框的值
|
|
123
|
+
// inputValue: this.value
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
watch: {
|
|
127
|
+
keyword(nVal) {
|
|
128
|
+
// 双向绑定值,让v-model绑定的值双向变化
|
|
129
|
+
this.$emit('input', nVal);
|
|
130
|
+
// 触发change事件,事件效果和v-model双向绑定的效果一样,让用户多一个选择
|
|
131
|
+
this.$emit('change', nVal);
|
|
132
|
+
},
|
|
133
|
+
value: {
|
|
134
|
+
immediate: true,
|
|
135
|
+
handler(nVal) {
|
|
136
|
+
this.keyword = nVal;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
computed: {
|
|
141
|
+
showActionBtn() {
|
|
142
|
+
return !this.animation && this.showAction
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
methods: {
|
|
146
|
+
// 目前HX2.6.9 v-model双向绑定无效,故监听input事件获取输入框内容的变化
|
|
147
|
+
inputChange(e) {
|
|
148
|
+
this.keyword = e.detail.value;
|
|
149
|
+
},
|
|
150
|
+
// 清空输入
|
|
151
|
+
// 也可以作为用户通过this.$refs形式调用清空输入框内容
|
|
152
|
+
clear() {
|
|
153
|
+
this.keyword = '';
|
|
154
|
+
// 延后发出事件,避免在父组件监听clear事件时,value为更新前的值(不为空)
|
|
155
|
+
this.$nextTick(() => {
|
|
156
|
+
this.$emit('clear');
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
// 确定搜索
|
|
160
|
+
search(e) {
|
|
161
|
+
this.$emit('search', e.detail.value);
|
|
162
|
+
try {
|
|
163
|
+
// 收起键盘
|
|
164
|
+
uni.hideKeyboard();
|
|
165
|
+
} catch (e) {}
|
|
166
|
+
},
|
|
167
|
+
// 点击右边自定义按钮的事件
|
|
168
|
+
custom() {
|
|
169
|
+
this.$emit('custom', this.keyword);
|
|
170
|
+
try {
|
|
171
|
+
// 收起键盘
|
|
172
|
+
uni.hideKeyboard();
|
|
173
|
+
} catch (e) {}
|
|
174
|
+
},
|
|
175
|
+
// 获取焦点
|
|
176
|
+
getFocus() {
|
|
177
|
+
this.focused = true;
|
|
178
|
+
// 开启右侧搜索按钮展开的动画效果
|
|
179
|
+
if (this.animation && this.showAction) this.show = true;
|
|
180
|
+
this.$emit('focus', this.keyword);
|
|
181
|
+
},
|
|
182
|
+
// 失去焦点
|
|
183
|
+
blur() {
|
|
184
|
+
// 最开始使用的是监听图标@touchstart事件,自从hx2.8.4后,此方法在微信小程序出错
|
|
185
|
+
// 这里改为监听点击事件,手点击清除图标时,同时也发生了@blur事件,导致图标消失而无法点击,这里做一个延时
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
this.focused = false;
|
|
188
|
+
}, 100)
|
|
189
|
+
this.show = false;
|
|
190
|
+
this.$emit('blur', this.keyword);
|
|
191
|
+
},
|
|
192
|
+
// 点击搜索框,只有disabled=true时才发出事件,因为禁止了输入,意味着是想跳转真正的搜索页
|
|
193
|
+
clickHandler() {
|
|
194
|
+
if (this.disabled) this.$emit('click');
|
|
195
|
+
},
|
|
196
|
+
// 点击左边图标
|
|
197
|
+
clickIcon() {
|
|
198
|
+
this.$emit('clickIcon');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<style lang="scss" scoped>
|
|
205
|
+
@import "../../libs/css/components.scss";
|
|
206
|
+
$u-search-content-padding: 0 10px !default;
|
|
207
|
+
$u-search-label-color: $u-main-color !default;
|
|
208
|
+
$u-search-label-font-size: 14px !default;
|
|
209
|
+
$u-search-label-margin: 0 4px !default;
|
|
210
|
+
$u-search-close-size: 20px !default;
|
|
211
|
+
$u-search-close-radius: 100px !default;
|
|
212
|
+
$u-search-close-bgColor: #C6C7CB !default;
|
|
213
|
+
$u-search-close-transform: scale(0.82) !default;
|
|
214
|
+
$u-search-input-font-size: 14px !default;
|
|
215
|
+
$u-search-input-margin: 0 5px !default;
|
|
216
|
+
$u-search-input-color: $u-main-color !default;
|
|
217
|
+
$u-search-input-placeholder-color: $u-tips-color !default;
|
|
218
|
+
$u-search-action-font-size: 14px !default;
|
|
219
|
+
$u-search-action-color: $u-main-color !default;
|
|
220
|
+
$u-search-action-width: 0 !default;
|
|
221
|
+
$u-search-action-active-width: 40px !default;
|
|
222
|
+
$u-search-action-margin-left: 5px !default;
|
|
223
|
+
|
|
224
|
+
/* #ifdef H5 */
|
|
225
|
+
// iOS15在H5下,hx的某些版本,input type=search时,会多了一个搜索图标,进行移除
|
|
226
|
+
[type="search"]::-webkit-search-decoration {
|
|
227
|
+
display: none;
|
|
228
|
+
}
|
|
229
|
+
/* #endif */
|
|
230
|
+
|
|
231
|
+
.u-search {
|
|
232
|
+
@include flex(row);
|
|
233
|
+
align-items: center;
|
|
234
|
+
flex: 1;
|
|
235
|
+
|
|
236
|
+
&__content {
|
|
237
|
+
@include flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
padding: $u-search-content-padding;
|
|
240
|
+
flex: 1;
|
|
241
|
+
justify-content: space-between;
|
|
242
|
+
border-width: 1px;
|
|
243
|
+
border-color: transparent;
|
|
244
|
+
border-style: solid;
|
|
245
|
+
overflow: hidden;
|
|
246
|
+
|
|
247
|
+
&__icon {
|
|
248
|
+
@include flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&__label {
|
|
253
|
+
color: $u-search-label-color;
|
|
254
|
+
font-size: $u-search-label-font-size;
|
|
255
|
+
margin: $u-search-label-margin;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&__close {
|
|
259
|
+
width: $u-search-close-size;
|
|
260
|
+
height: $u-search-close-size;
|
|
261
|
+
border-top-left-radius: $u-search-close-radius;
|
|
262
|
+
border-top-right-radius: $u-search-close-radius;
|
|
263
|
+
border-bottom-left-radius: $u-search-close-radius;
|
|
264
|
+
border-bottom-right-radius: $u-search-close-radius;
|
|
265
|
+
background-color: $u-search-close-bgColor;
|
|
266
|
+
@include flex(row);
|
|
267
|
+
align-items: center;
|
|
268
|
+
justify-content: center;
|
|
269
|
+
transform: $u-search-close-transform;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&__input {
|
|
273
|
+
flex: 1;
|
|
274
|
+
font-size: $u-search-input-font-size;
|
|
275
|
+
line-height: 1;
|
|
276
|
+
margin: $u-search-input-margin;
|
|
277
|
+
color: $u-search-input-color;
|
|
278
|
+
|
|
279
|
+
&--placeholder {
|
|
280
|
+
color: $u-search-input-placeholder-color;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&__action {
|
|
286
|
+
font-size: $u-search-action-font-size;
|
|
287
|
+
color: $u-search-action-color;
|
|
288
|
+
width: $u-search-action-width;
|
|
289
|
+
overflow: hidden;
|
|
290
|
+
transition-property: width;
|
|
291
|
+
transition-duration: 0.3s;
|
|
292
|
+
/* #ifndef APP-NVUE */
|
|
293
|
+
white-space: nowrap;
|
|
294
|
+
/* #endif */
|
|
295
|
+
text-align: center;
|
|
296
|
+
|
|
297
|
+
&--active {
|
|
298
|
+
width: $u-search-action-active-width;
|
|
299
|
+
margin-left: $u-search-action-margin-left;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否展示骨架组件
|
|
4
|
+
loading: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: uni.$u.props.skeleton.loading
|
|
7
|
+
},
|
|
8
|
+
// 是否开启动画效果
|
|
9
|
+
animate: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: uni.$u.props.skeleton.animate
|
|
12
|
+
},
|
|
13
|
+
// 段落占位图行数
|
|
14
|
+
rows: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: uni.$u.props.skeleton.rows
|
|
17
|
+
},
|
|
18
|
+
// 段落占位图的宽度
|
|
19
|
+
rowsWidth: {
|
|
20
|
+
type: [String, Number, Array],
|
|
21
|
+
default: uni.$u.props.skeleton.rowsWidth
|
|
22
|
+
},
|
|
23
|
+
// 段落占位图的高度
|
|
24
|
+
rowsHeight: {
|
|
25
|
+
type: [String, Number, Array],
|
|
26
|
+
default: uni.$u.props.skeleton.rowsHeight
|
|
27
|
+
},
|
|
28
|
+
// 是否展示标题占位图
|
|
29
|
+
title: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: uni.$u.props.skeleton.title
|
|
32
|
+
},
|
|
33
|
+
// 段落标题的宽度
|
|
34
|
+
titleWidth: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: uni.$u.props.skeleton.titleWidth
|
|
37
|
+
},
|
|
38
|
+
// 段落标题的高度
|
|
39
|
+
titleHeight: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: uni.$u.props.skeleton.titleHeight
|
|
42
|
+
},
|
|
43
|
+
// 是否展示头像占位图
|
|
44
|
+
avatar: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: uni.$u.props.skeleton.avatar
|
|
47
|
+
},
|
|
48
|
+
// 头像占位图大小
|
|
49
|
+
avatarSize: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: uni.$u.props.skeleton.avatarSize
|
|
52
|
+
},
|
|
53
|
+
// 头像占位图的形状,circle-圆形,square-方形
|
|
54
|
+
avatarShape: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: uni.$u.props.skeleton.avatarShape
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|