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,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 使用bindingx方案实现slider
|
|
3
|
+
* 只能使用于nvue下
|
|
4
|
+
*/
|
|
5
|
+
// 引入bindingx,此库类似于微信小程序wxs,目的是让js运行在视图层,减少视图层和逻辑层的通信折损
|
|
6
|
+
const BindingX = uni.requireNativePlugin('bindingx')
|
|
7
|
+
// nvue操作dom的库,用于获取dom的尺寸信息
|
|
8
|
+
const dom = uni.requireNativePlugin('dom')
|
|
9
|
+
// nvue中用于操作元素动画的库,类似于uni.animation,只不过uni.animation不能用于nvue
|
|
10
|
+
const animation = uni.requireNativePlugin('animation')
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
data() {
|
|
14
|
+
return {
|
|
15
|
+
// 位移的偏移量
|
|
16
|
+
x: 0,
|
|
17
|
+
// 是否正在触摸过程中,用于标记动画类是否添加或移除
|
|
18
|
+
touching: false,
|
|
19
|
+
changeFromInside: false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
watch: {
|
|
23
|
+
// 监听vlaue的变化,此变化可能是由于内部修改v-model的值,或者外部
|
|
24
|
+
// 从服务端获取一个值后,赋值给slider的v-model而导致的
|
|
25
|
+
value(n) {
|
|
26
|
+
if (!this.changeFromInside) {
|
|
27
|
+
this.initX()
|
|
28
|
+
} else {
|
|
29
|
+
this.changeFromInside = false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
mounted() {
|
|
34
|
+
this.init()
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
init() {
|
|
38
|
+
// 更新滑块尺寸信息
|
|
39
|
+
this.getSliderRect().then((size) => {
|
|
40
|
+
this.sliderRect = size
|
|
41
|
+
this.initX()
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
// 获取节点信息
|
|
45
|
+
// 获取slider尺寸
|
|
46
|
+
getSliderRect() {
|
|
47
|
+
// 获取滑块条的尺寸信息
|
|
48
|
+
// 通过nvue的dom模块,查询节点信息
|
|
49
|
+
return new Promise((resolve) => {
|
|
50
|
+
this.$nextTick(() => {
|
|
51
|
+
dom.getComponentRect(this.$refs.slider, (res) => {
|
|
52
|
+
resolve(res.size)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
// 初始化按钮位置
|
|
58
|
+
initButtonStyle({
|
|
59
|
+
barStyle,
|
|
60
|
+
buttonWrapperStyle
|
|
61
|
+
}) {
|
|
62
|
+
this.barStyle = barStyle
|
|
63
|
+
this.buttonWrapperStyle = buttonWrapperStyle
|
|
64
|
+
},
|
|
65
|
+
emitEvent(event, value) {
|
|
66
|
+
this.$emit(event, value || this.value)
|
|
67
|
+
},
|
|
68
|
+
// 滑动开始
|
|
69
|
+
async onTouchStart(e) {
|
|
70
|
+
// if (this.disabled) return
|
|
71
|
+
// // 阻止页面滚动,可以保证在滑动过程中,不让页面可以上下滚动,造成不好的体验
|
|
72
|
+
// e.stopPropagation && e.stopPropagation()
|
|
73
|
+
// e.preventDefault && e.preventDefault()
|
|
74
|
+
// // 更新滑块的尺寸信息
|
|
75
|
+
// this.sliderRect = await this.getSliderRect()
|
|
76
|
+
// // 标记滑动过程中触摸点的信息
|
|
77
|
+
// this.touchStart(e)
|
|
78
|
+
// this.startValue = this.format(this.value)
|
|
79
|
+
// this.dragStatus = 'start'
|
|
80
|
+
|
|
81
|
+
// 标记滑动过程中触摸点的信息
|
|
82
|
+
// this.touchStart(e)
|
|
83
|
+
},
|
|
84
|
+
// 开始滑动
|
|
85
|
+
onTouchMove(e) {
|
|
86
|
+
// if (this.disabled) return;
|
|
87
|
+
// if (this.dragStatus === 'start') {
|
|
88
|
+
// this.$emit('drag-start')
|
|
89
|
+
// }
|
|
90
|
+
// // 标记当前滑动过程中的触点信息,此方法在touch mixin中
|
|
91
|
+
// this.touchMove(e)
|
|
92
|
+
// this.dragStatus = 'draging'
|
|
93
|
+
// const {
|
|
94
|
+
// width: sliderWidth
|
|
95
|
+
// } = this.sliderRect
|
|
96
|
+
// const diff = (this.deltaX / sliderWidth) * this.getRange()
|
|
97
|
+
// this.newValue = this.startValue + diff
|
|
98
|
+
// this.updateValue(this.newValue, false, true)
|
|
99
|
+
// 获取元素ref
|
|
100
|
+
// const button = this.$refs['nvue-button'].ref
|
|
101
|
+
// const gap = this.$refs['nvue-gap'].ref
|
|
102
|
+
|
|
103
|
+
// animation.transition(gap, {
|
|
104
|
+
// styles: {
|
|
105
|
+
// width: `${this.startX + this.deltaX}px`
|
|
106
|
+
// }
|
|
107
|
+
// })
|
|
108
|
+
// // console.log(this.startX + this.deltaX);
|
|
109
|
+
// animation.transition(button, {
|
|
110
|
+
// styles: {
|
|
111
|
+
// transform: `translateX(${this.startX + this.deltaX}px)`
|
|
112
|
+
// }
|
|
113
|
+
// })
|
|
114
|
+
// this.barStyle = {
|
|
115
|
+
// width: `${this.startX + this.deltaX}px`
|
|
116
|
+
// }
|
|
117
|
+
const {
|
|
118
|
+
x
|
|
119
|
+
} = this.getTouchPoint(e)
|
|
120
|
+
this.buttonWrapperStyle = {
|
|
121
|
+
transform: `translateX(${x}px)`
|
|
122
|
+
}
|
|
123
|
+
// this.buttonWrapperStyle = {
|
|
124
|
+
// transform: `translateX(${this.format(this.startX + this.deltaX)}px)`
|
|
125
|
+
// }
|
|
126
|
+
},
|
|
127
|
+
// onTouchEnd() {
|
|
128
|
+
// if (this.disabled) return;
|
|
129
|
+
// if (this.dragStatus === 'draging') {
|
|
130
|
+
// this.updateValue(this.newValue, true)
|
|
131
|
+
// this.$emit('drag-end');
|
|
132
|
+
// }
|
|
133
|
+
// },
|
|
134
|
+
updateValue(value, end, drag) {
|
|
135
|
+
value = this.format(value)
|
|
136
|
+
const {
|
|
137
|
+
width: sliderWidth
|
|
138
|
+
} = this.sliderRect
|
|
139
|
+
const width = `${((value - this.min) * sliderWidth) / this.getRange()}`
|
|
140
|
+
this.value = value
|
|
141
|
+
this.barStyle = {
|
|
142
|
+
width: `${width}px`
|
|
143
|
+
}
|
|
144
|
+
// console.log('width', width);
|
|
145
|
+
if (drag) {
|
|
146
|
+
this.$emit('drag', {
|
|
147
|
+
value
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
if (end) {
|
|
151
|
+
this.$emit('change', value)
|
|
152
|
+
}
|
|
153
|
+
if ((drag || end)) {
|
|
154
|
+
this.changeFromInside = true
|
|
155
|
+
this.$emit('update', value)
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
// 从value的变化,倒推得出x的值该为多少
|
|
159
|
+
initX() {
|
|
160
|
+
const {
|
|
161
|
+
left,
|
|
162
|
+
width
|
|
163
|
+
} = this.sliderRect
|
|
164
|
+
// 得出x的初始偏移值,之所以需要这么做,是因为在bindingX中,触摸滑动时,只能的值本次移动的偏移值
|
|
165
|
+
// 而无法的值准确的前后移动的两个点的坐标值,weex纯粹为阿里巴巴的KPI(部门业绩考核)产物,也就这样了
|
|
166
|
+
this.x = this.value / 100 * width
|
|
167
|
+
// 设置移动的值
|
|
168
|
+
const barStyle = {
|
|
169
|
+
width: `${this.x}px`
|
|
170
|
+
}
|
|
171
|
+
// 按钮的初始值
|
|
172
|
+
const buttonWrapperStyle = {
|
|
173
|
+
transform: `translateX(${this.x - this.blockHeight / 2}px)`
|
|
174
|
+
}
|
|
175
|
+
this.initButtonStyle({
|
|
176
|
+
barStyle,
|
|
177
|
+
buttonWrapperStyle
|
|
178
|
+
})
|
|
179
|
+
},
|
|
180
|
+
// 移动点占总长度的百分比,此处需要先除以step,是为了保证step大于1时,比如10,那么在滑动11,12px这样的
|
|
181
|
+
// 距离时,实际上滑块是不会滑动的,到了16,17px,经过四舍五入后,就变成了20px,进行了下一个跳变
|
|
182
|
+
format(value) {
|
|
183
|
+
return Math.round(uni.$u.range(this.min, this.max, value) / this.step) * this.step
|
|
184
|
+
},
|
|
185
|
+
getRange() {
|
|
186
|
+
const {
|
|
187
|
+
max,
|
|
188
|
+
min
|
|
189
|
+
} = this
|
|
190
|
+
return max - min
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 最小可选值
|
|
4
|
+
min: {
|
|
5
|
+
type: [Number, String],
|
|
6
|
+
default: uni.$u.props.slider.min
|
|
7
|
+
},
|
|
8
|
+
// 最大可选值
|
|
9
|
+
max: {
|
|
10
|
+
type: [Number, String],
|
|
11
|
+
default: uni.$u.props.slider.max
|
|
12
|
+
},
|
|
13
|
+
// 步长,取值必须大于 0,并且可被(max - min)整除
|
|
14
|
+
step: {
|
|
15
|
+
type: [Number, String],
|
|
16
|
+
default: uni.$u.props.slider.step
|
|
17
|
+
},
|
|
18
|
+
// 当前取值
|
|
19
|
+
value: {
|
|
20
|
+
type: [Number, String],
|
|
21
|
+
default: uni.$u.props.slider.value
|
|
22
|
+
},
|
|
23
|
+
// 滑块右侧已选择部分的背景色
|
|
24
|
+
activeColor: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: uni.$u.props.slider.activeColor
|
|
27
|
+
},
|
|
28
|
+
// 滑块左侧未选择部分的背景色
|
|
29
|
+
inactiveColor: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: uni.$u.props.slider.inactiveColor
|
|
32
|
+
},
|
|
33
|
+
// 滑块的大小,取值范围为 12 - 28
|
|
34
|
+
blockSize: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: uni.$u.props.slider.blockSize
|
|
37
|
+
},
|
|
38
|
+
// 滑块的颜色
|
|
39
|
+
blockColor: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: uni.$u.props.slider.blockColor
|
|
42
|
+
},
|
|
43
|
+
// 禁用状态
|
|
44
|
+
disabled: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: uni.$u.props.slider.disabled
|
|
47
|
+
},
|
|
48
|
+
// 是否显示当前的选择值
|
|
49
|
+
showValue: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: uni.$u.props.slider.showValue
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-slider"
|
|
4
|
+
:style="[$u.addStyle(customStyle)]"
|
|
5
|
+
>
|
|
6
|
+
<slider
|
|
7
|
+
:min="min"
|
|
8
|
+
:max="max"
|
|
9
|
+
:step="step"
|
|
10
|
+
:value="value"
|
|
11
|
+
:activeColor="activeColor"
|
|
12
|
+
:inactiveColor="inactiveColor"
|
|
13
|
+
:blockSize="$u.getPx(blockSize)"
|
|
14
|
+
:blockColor="blockColor"
|
|
15
|
+
:showValue="showValue"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
@changing="changingHandler"
|
|
18
|
+
@change="changeHandler"
|
|
19
|
+
></slider>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import props from './props.js'
|
|
25
|
+
export default {
|
|
26
|
+
name: 'u--slider',
|
|
27
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
28
|
+
methods: {
|
|
29
|
+
// 拖动过程中触发
|
|
30
|
+
changingHandler(e) {
|
|
31
|
+
const {
|
|
32
|
+
value
|
|
33
|
+
} = e.detail
|
|
34
|
+
// 更新v-model的值
|
|
35
|
+
this.$emit('input', value)
|
|
36
|
+
// 触发事件
|
|
37
|
+
this.$emit('changing', value)
|
|
38
|
+
},
|
|
39
|
+
// 滑动结束时触发
|
|
40
|
+
changeHandler(e) {
|
|
41
|
+
const {
|
|
42
|
+
value
|
|
43
|
+
} = e.detail
|
|
44
|
+
// 更新v-model的值
|
|
45
|
+
this.$emit('input', value)
|
|
46
|
+
// 触发事件
|
|
47
|
+
this.$emit('change', value)
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss" scoped>
|
|
54
|
+
@import "../../libs/css/components.scss";
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:style="[style]"
|
|
4
|
+
class="u-status-bar"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import props from './props.js';
|
|
12
|
+
/**
|
|
13
|
+
* StatbusBar 状态栏占位
|
|
14
|
+
* @description 本组件主要用于状态填充,比如在自定导航栏的时候,它会自动适配一个恰当的状态栏高度。
|
|
15
|
+
* @tutorial https://uviewui.com/components/statusBar.html
|
|
16
|
+
* @property {String} bgColor 背景色 (默认 'transparent' )
|
|
17
|
+
* @property {String | Object} customStyle 自定义样式
|
|
18
|
+
* @example <u-status-bar></u-status-bar>
|
|
19
|
+
*/
|
|
20
|
+
export default {
|
|
21
|
+
name: 'u-status-bar',
|
|
22
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
computed: {
|
|
28
|
+
style() {
|
|
29
|
+
const style = {}
|
|
30
|
+
// 状态栏高度,由于某些安卓和微信开发工具无法识别css的顶部状态栏变量,所以使用js获取的方式
|
|
31
|
+
style.height = uni.$u.addUnit(uni.$u.sys().statusBarHeight, 'px')
|
|
32
|
+
style.backgroundColor = this.bgColor
|
|
33
|
+
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="scss" scoped>
|
|
40
|
+
.u-status-bar {
|
|
41
|
+
// nvue会默认100%,如果nvue下,显式写100%的话,会导致宽度不为100%而异常
|
|
42
|
+
/* #ifndef APP-NVUE */
|
|
43
|
+
width: 100%;
|
|
44
|
+
/* #endif */
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 排列方向
|
|
4
|
+
direction: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: uni.$u.props.steps.direction
|
|
7
|
+
},
|
|
8
|
+
// 设置第几个步骤
|
|
9
|
+
current: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
default: uni.$u.props.steps.current
|
|
12
|
+
},
|
|
13
|
+
// 激活状态颜色
|
|
14
|
+
activeColor: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: uni.$u.props.steps.activeColor
|
|
17
|
+
},
|
|
18
|
+
// 未激活状态颜色
|
|
19
|
+
inactiveColor: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: uni.$u.props.steps.inactiveColor
|
|
22
|
+
},
|
|
23
|
+
// 激活状态的图标
|
|
24
|
+
activeIcon: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: uni.$u.props.steps.activeIcon
|
|
27
|
+
},
|
|
28
|
+
// 未激活状态图标
|
|
29
|
+
inactiveIcon: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: uni.$u.props.steps.inactiveIcon
|
|
32
|
+
},
|
|
33
|
+
// 是否显示点类型
|
|
34
|
+
dot: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: uni.$u.props.steps.dot
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-steps"
|
|
4
|
+
:class="[`u-steps--${direction}`]"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import props from './props.js';
|
|
12
|
+
/**
|
|
13
|
+
* Steps 步骤条
|
|
14
|
+
* @description 该组件一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
|
|
15
|
+
* @tutorial https://uviewui.com/components/steps.html
|
|
16
|
+
* @property {String} direction row-横向,column-竖向 (默认 'row' )
|
|
17
|
+
* @property {String | Number} current 设置当前处于第几步 (默认 0 )
|
|
18
|
+
* @property {String} activeColor 激活状态颜色 (默认 '#3c9cff' )
|
|
19
|
+
* @property {String} inactiveColor 未激活状态颜色 (默认 '#969799' )
|
|
20
|
+
* @property {String} activeIcon 激活状态的图标
|
|
21
|
+
* @property {String} inactiveIcon 未激活状态图标
|
|
22
|
+
* @property {Boolean} dot 是否显示点类型 (默认 false )
|
|
23
|
+
* @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
|
|
24
|
+
*/
|
|
25
|
+
export default {
|
|
26
|
+
name: 'u-steps',
|
|
27
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
watch: {
|
|
33
|
+
children() {
|
|
34
|
+
this.updateChildData()
|
|
35
|
+
},
|
|
36
|
+
parentData() {
|
|
37
|
+
this.updateChildData()
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
computed: {
|
|
41
|
+
// 监听参数的变化,通过watch中,手动去更新子组件的数据,否则子组件不会自动变化
|
|
42
|
+
parentData() {
|
|
43
|
+
return [this.current, this.direction, this.activeColor, this.inactiveColor, this.activeIcon, this.inactiveIcon, this.dot]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
// 更新子组件的数据
|
|
48
|
+
updateChildData() {
|
|
49
|
+
this.children.map(child => {
|
|
50
|
+
// 先判断子组件是否存在对应的方法
|
|
51
|
+
uni.$u.test.func((child || {}).updateFromParent()) && child.updateFromParent()
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
// 接受子组件的通知,去修改其他子组件的数据
|
|
55
|
+
updateFromChild() {
|
|
56
|
+
this.updateChildData()
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
created() {
|
|
60
|
+
this.children = []
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="scss" scoped>
|
|
66
|
+
@import "../../libs/css/components.scss";
|
|
67
|
+
|
|
68
|
+
.u-steps {
|
|
69
|
+
@include flex;
|
|
70
|
+
|
|
71
|
+
&--column {
|
|
72
|
+
flex-direction: column
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&--row {
|
|
76
|
+
flex-direction: row;
|
|
77
|
+
flex: 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 标题
|
|
4
|
+
title: {
|
|
5
|
+
type: [String, Number],
|
|
6
|
+
default: uni.$u.props.stepsItem.title
|
|
7
|
+
},
|
|
8
|
+
// 描述文本
|
|
9
|
+
desc: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
default: uni.$u.props.stepsItem.desc
|
|
12
|
+
},
|
|
13
|
+
// 图标大小
|
|
14
|
+
iconSize: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: uni.$u.props.stepsItem.iconSize
|
|
17
|
+
},
|
|
18
|
+
// 当前步骤是否处于失败状态
|
|
19
|
+
error: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: uni.$u.props.stepsItem.error
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|