cbvirtua 1.0.100 → 1.0.102
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/5111.zip +0 -0
- package/dist/action-sheet/index.d.ts +1 -0
- package/dist/action-sheet/index.js +75 -0
- package/dist/action-sheet/index.json +8 -0
- package/dist/action-sheet/index.wxml +70 -0
- package/dist/action-sheet/index.wxss +1 -0
- package/dist/area/index.d.ts +1 -0
- package/dist/area/index.js +220 -0
- package/dist/area/index.json +6 -0
- package/dist/area/index.wxml +20 -0
- package/dist/area/index.wxs +8 -0
- package/dist/area/index.wxss +1 -0
- package/dist/button/index.d.ts +1 -0
- package/dist/button/index.js +64 -0
- package/dist/button/index.json +7 -0
- package/dist/button/index.wxml +56 -0
- package/dist/button/index.wxs +39 -0
- package/dist/button/index.wxss +1 -0
- package/dist/calendar/calendar.wxml +70 -0
- package/dist/calendar/components/header/index.d.ts +1 -0
- package/dist/calendar/components/header/index.js +37 -0
- package/dist/calendar/components/header/index.json +3 -0
- package/dist/calendar/components/header/index.wxml +16 -0
- package/dist/calendar/components/header/index.wxss +1 -0
- package/dist/calendar/components/month/index.d.ts +6 -0
- package/dist/calendar/components/month/index.js +154 -0
- package/dist/calendar/components/month/index.json +3 -0
- package/dist/calendar/components/month/index.wxml +39 -0
- package/dist/calendar/components/month/index.wxs +71 -0
- package/dist/calendar/components/month/index.wxss +1 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +360 -0
- package/dist/calendar/index.json +10 -0
- package/dist/calendar/index.wxml +27 -0
- package/dist/calendar/index.wxs +37 -0
- package/dist/calendar/index.wxss +1 -0
- package/dist/calendar/utils.d.ts +12 -0
- package/dist/calendar/utils.js +83 -0
- package/dist/calendar/utils.wxs +25 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +49 -0
- package/dist/card/index.json +6 -0
- package/dist/card/index.wxml +56 -0
- package/dist/card/index.wxss +1 -0
- package/dist/cascader/index.d.ts +1 -0
- package/dist/cascader/index.js +214 -0
- package/dist/cascader/index.json +8 -0
- package/dist/cascader/index.wxml +55 -0
- package/dist/cascader/index.wxs +24 -0
- package/dist/cascader/index.wxss +1 -0
- package/dist/cell/index.d.ts +1 -0
- package/dist/cell/index.js +38 -0
- package/dist/cell/index.json +6 -0
- package/dist/cell/index.wxml +47 -0
- package/dist/cell/index.wxs +17 -0
- package/dist/cell/index.wxss +1 -0
- package/dist/cell-group/index.d.ts +1 -0
- package/dist/cell-group/index.js +11 -0
- package/dist/cell-group/index.json +3 -0
- package/dist/cell-group/index.wxml +11 -0
- package/dist/cell-group/index.wxss +1 -0
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.js +77 -0
- package/dist/checkbox/index.json +6 -0
- package/dist/checkbox/index.wxml +31 -0
- package/dist/checkbox/index.wxs +20 -0
- package/dist/checkbox/index.wxss +1 -0
- package/dist/checkbox-group/index.d.ts +1 -0
- package/dist/checkbox-group/index.js +36 -0
- package/dist/checkbox-group/index.json +3 -0
- package/dist/checkbox-group/index.wxml +5 -0
- package/dist/checkbox-group/index.wxss +1 -0
- package/dist/circle/canvas.d.ts +4 -0
- package/dist/circle/canvas.js +43 -0
- package/dist/circle/index.d.ts +1 -0
- package/dist/circle/index.js +197 -0
- package/dist/circle/index.json +3 -0
- package/dist/circle/index.wxml +9 -0
- package/dist/circle/index.wxss +1 -0
- package/dist/col/index.d.ts +1 -0
- package/dist/col/index.js +9 -0
- package/dist/col/index.json +3 -0
- package/dist/col/index.wxml +9 -0
- package/dist/col/index.wxs +18 -0
- package/dist/col/index.wxss +1 -0
- package/dist/collapse/index.d.ts +1 -0
- package/dist/collapse/index.js +46 -0
- package/dist/collapse/index.json +3 -0
- package/dist/collapse/index.wxml +3 -0
- package/dist/collapse/index.wxss +1 -0
- package/dist/collapse-item/animate.d.ts +2 -0
- package/dist/collapse-item/animate.js +39 -0
- package/dist/collapse-item/index.d.ts +1 -0
- package/dist/collapse-item/index.js +61 -0
- package/dist/collapse-item/index.json +6 -0
- package/dist/collapse-item/index.wxml +45 -0
- package/dist/collapse-item/index.wxss +1 -0
- package/dist/common/color.d.ts +7 -0
- package/dist/common/color.js +7 -0
- package/dist/common/component.d.ts +4 -0
- package/dist/common/component.js +46 -0
- package/dist/common/index.wxss +1 -0
- package/dist/common/relation.d.ts +15 -0
- package/dist/common/relation.js +56 -0
- package/dist/common/style/clearfix.wxss +1 -0
- package/dist/common/style/ellipsis.wxss +1 -0
- package/dist/common/style/hairline.wxss +1 -0
- package/dist/common/style/mixins/clearfix.wxss +0 -0
- package/dist/common/style/mixins/ellipsis.wxss +0 -0
- package/dist/common/style/mixins/hairline.wxss +0 -0
- package/dist/common/style/var.wxss +0 -0
- package/dist/common/utils.d.ts +21 -0
- package/dist/common/utils.js +86 -0
- package/dist/common/validator.d.ts +9 -0
- package/dist/common/validator.js +31 -0
- package/dist/common/version.d.ts +15 -0
- package/dist/common/version.js +59 -0
- package/dist/config-provider/index.d.ts +1 -0
- package/dist/config-provider/index.js +9 -0
- package/dist/config-provider/index.json +3 -0
- package/dist/config-provider/index.wxml +5 -0
- package/dist/config-provider/index.wxs +29 -0
- package/dist/count-down/index.d.ts +1 -0
- package/dist/count-down/index.js +100 -0
- package/dist/count-down/index.json +3 -0
- package/dist/count-down/index.wxml +4 -0
- package/dist/count-down/index.wxss +1 -0
- package/dist/count-down/utils.d.ts +10 -0
- package/dist/count-down/utils.js +57 -0
- package/dist/datetime-picker/index.d.ts +1 -0
- package/dist/datetime-picker/index.js +295 -0
- package/dist/datetime-picker/index.json +6 -0
- package/dist/datetime-picker/index.wxml +16 -0
- package/dist/datetime-picker/index.wxss +1 -0
- package/dist/definitions/index.d.ts +29 -0
- package/dist/definitions/index.js +1 -0
- package/dist/dialog/dialog.d.ts +55 -0
- package/dist/dialog/dialog.js +77 -0
- package/dist/dialog/index.d.ts +1 -0
- package/dist/dialog/index.js +132 -0
- package/dist/dialog/index.json +9 -0
- package/dist/dialog/index.wxml +126 -0
- package/dist/dialog/index.wxss +1 -0
- package/dist/divider/index.d.ts +1 -0
- package/dist/divider/index.js +12 -0
- package/dist/divider/index.json +4 -0
- package/dist/divider/index.wxml +9 -0
- package/dist/divider/index.wxs +18 -0
- package/dist/divider/index.wxss +1 -0
- package/dist/dropdown-item/index.d.ts +1 -0
- package/dist/dropdown-item/index.js +130 -0
- package/dist/dropdown-item/index.json +8 -0
- package/dist/dropdown-item/index.wxml +50 -0
- package/dist/dropdown-item/index.wxss +1 -0
- package/dist/dropdown-item/shared.d.ts +5 -0
- package/dist/dropdown-item/shared.js +1 -0
- package/dist/dropdown-menu/index.d.ts +1 -0
- package/dist/dropdown-menu/index.js +117 -0
- package/dist/dropdown-menu/index.json +3 -0
- package/dist/dropdown-menu/index.wxml +23 -0
- package/dist/dropdown-menu/index.wxs +16 -0
- package/dist/dropdown-menu/index.wxss +1 -0
- package/dist/empty/index.d.ts +1 -0
- package/dist/empty/index.js +10 -0
- package/dist/empty/index.json +4 -0
- package/dist/empty/index.wxml +22 -0
- package/dist/empty/index.wxs +15 -0
- package/dist/empty/index.wxss +1 -0
- package/dist/field/index.d.ts +1 -0
- package/dist/field/index.js +138 -0
- package/dist/field/index.json +7 -0
- package/dist/field/index.wxml +56 -0
- package/dist/field/index.wxs +18 -0
- package/dist/field/index.wxss +1 -0
- package/dist/field/input.wxml +31 -0
- package/dist/field/props.d.ts +4 -0
- package/dist/field/props.js +56 -0
- package/dist/field/textarea.wxml +32 -0
- package/dist/field/types.d.ts +8 -0
- package/dist/field/types.js +1 -0
- package/dist/goods-action/index.d.ts +1 -0
- package/dist/goods-action/index.js +15 -0
- package/dist/goods-action/index.json +3 -0
- package/dist/goods-action/index.wxml +5 -0
- package/dist/goods-action/index.wxss +1 -0
- package/dist/goods-action-button/index.d.ts +1 -0
- package/dist/goods-action-button/index.js +44 -0
- package/dist/goods-action-button/index.json +6 -0
- package/dist/goods-action-button/index.wxml +35 -0
- package/dist/goods-action-button/index.wxss +1 -0
- package/dist/goods-action-icon/index.d.ts +1 -0
- package/dist/goods-action-icon/index.js +27 -0
- package/dist/goods-action-icon/index.json +7 -0
- package/dist/goods-action-icon/index.wxml +41 -0
- package/dist/goods-action-icon/index.wxss +1 -0
- package/dist/grid/index.d.ts +1 -0
- package/dist/grid/index.js +55 -0
- package/dist/grid/index.json +3 -0
- package/dist/grid/index.wxml +8 -0
- package/dist/grid/index.wxs +13 -0
- package/dist/grid/index.wxss +1 -0
- package/dist/grid-item/index.d.ts +1 -0
- package/dist/grid-item/index.js +52 -0
- package/dist/grid-item/index.json +6 -0
- package/dist/grid-item/index.wxml +27 -0
- package/dist/grid-item/index.wxs +32 -0
- package/dist/grid-item/index.wxss +1 -0
- package/dist/icon/index.d.ts +1 -0
- package/dist/icon/index.js +21 -0
- package/dist/icon/index.json +6 -0
- package/dist/icon/index.wxml +20 -0
- package/dist/icon/index.wxs +43 -0
- package/dist/icon/index.wxss +1 -0
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +64 -0
- package/dist/image/index.json +7 -0
- package/dist/image/index.wxml +35 -0
- package/dist/image/index.wxs +32 -0
- package/dist/image/index.wxss +1 -0
- package/dist/index-anchor/index.d.ts +1 -0
- package/dist/index-anchor/index.js +25 -0
- package/dist/index-anchor/index.json +3 -0
- package/dist/index-anchor/index.wxml +14 -0
- package/dist/index-anchor/index.wxss +1 -0
- package/dist/index-bar/index.d.ts +1 -0
- package/dist/index-bar/index.js +246 -0
- package/dist/index-bar/index.json +3 -0
- package/dist/index-bar/index.wxml +22 -0
- package/dist/index-bar/index.wxss +1 -0
- package/dist/info/index.d.ts +1 -0
- package/dist/info/index.js +8 -0
- package/dist/info/index.json +3 -0
- package/dist/info/index.wxml +7 -0
- package/dist/info/index.wxss +1 -0
- package/dist/loading/index.d.ts +1 -0
- package/dist/loading/index.js +16 -0
- package/dist/loading/index.json +3 -0
- package/dist/loading/index.wxml +19 -0
- package/dist/loading/index.wxs +22 -0
- package/dist/loading/index.wxss +1 -0
- package/dist/mixins/basic.d.ts +1 -0
- package/dist/mixins/basic.js +26 -0
- package/dist/mixins/button.d.ts +1 -0
- package/dist/mixins/button.js +51 -0
- package/dist/mixins/link.d.ts +1 -0
- package/dist/mixins/link.js +23 -0
- package/dist/mixins/page-scroll.d.ts +6 -0
- package/dist/mixins/page-scroll.js +42 -0
- package/dist/mixins/touch.d.ts +1 -0
- package/dist/mixins/touch.js +37 -0
- package/dist/mixins/transition.d.ts +1 -0
- package/dist/mixins/transition.js +136 -0
- package/dist/nav-bar/index.d.ts +1 -0
- package/dist/nav-bar/index.js +65 -0
- package/dist/nav-bar/index.json +6 -0
- package/dist/nav-bar/index.wxml +42 -0
- package/dist/nav-bar/index.wxs +13 -0
- package/dist/nav-bar/index.wxss +1 -0
- package/dist/notice-bar/index.d.ts +1 -0
- package/dist/notice-bar/index.js +132 -0
- package/dist/notice-bar/index.json +6 -0
- package/dist/notice-bar/index.wxml +38 -0
- package/dist/notice-bar/index.wxs +15 -0
- package/dist/notice-bar/index.wxss +1 -0
- package/dist/notify/index.d.ts +1 -0
- package/dist/notify/index.js +65 -0
- package/dist/notify/index.json +6 -0
- package/dist/notify/index.wxml +21 -0
- package/dist/notify/index.wxs +22 -0
- package/dist/notify/index.wxss +1 -0
- package/dist/notify/notify.d.ts +22 -0
- package/dist/notify/notify.js +53 -0
- package/dist/overlay/index.d.ts +1 -0
- package/dist/overlay/index.js +30 -0
- package/dist/overlay/index.json +6 -0
- package/dist/overlay/index.wxml +7 -0
- package/dist/overlay/index.wxss +1 -0
- package/dist/overlay/overlay.wxml +10 -0
- package/dist/panel/index.d.ts +1 -0
- package/dist/panel/index.js +9 -0
- package/dist/panel/index.json +6 -0
- package/dist/panel/index.wxml +19 -0
- package/dist/panel/index.wxss +1 -0
- package/dist/picker/index.d.ts +1 -0
- package/dist/picker/index.js +136 -0
- package/dist/picker/index.json +7 -0
- package/dist/picker/index.wxml +37 -0
- package/dist/picker/index.wxs +42 -0
- package/dist/picker/index.wxss +1 -0
- package/dist/picker/shared.d.ts +21 -0
- package/dist/picker/shared.js +21 -0
- package/dist/picker/toolbar.wxml +23 -0
- package/dist/picker-column/index.d.ts +1 -0
- package/dist/picker-column/index.js +118 -0
- package/dist/picker-column/index.json +3 -0
- package/dist/picker-column/index.wxml +23 -0
- package/dist/picker-column/index.wxs +36 -0
- package/dist/picker-column/index.wxss +1 -0
- package/dist/popup/index.d.ts +1 -0
- package/dist/popup/index.js +97 -0
- package/dist/popup/index.json +7 -0
- package/dist/popup/index.wxml +21 -0
- package/dist/popup/index.wxs +18 -0
- package/dist/popup/index.wxss +1 -0
- package/dist/popup/popup.wxml +16 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +51 -0
- package/dist/progress/index.json +3 -0
- package/dist/progress/index.wxml +20 -0
- package/dist/progress/index.wxs +36 -0
- package/dist/progress/index.wxss +1 -0
- package/dist/radio/index.d.ts +1 -0
- package/dist/radio/index.js +66 -0
- package/dist/radio/index.json +6 -0
- package/dist/radio/index.wxml +30 -0
- package/dist/radio/index.wxs +33 -0
- package/dist/radio/index.wxss +1 -0
- package/dist/radio-group/index.d.ts +1 -0
- package/dist/radio-group/index.js +22 -0
- package/dist/radio-group/index.json +3 -0
- package/dist/radio-group/index.wxml +5 -0
- package/dist/radio-group/index.wxss +1 -0
- package/dist/rate/index.d.ts +1 -0
- package/dist/rate/index.js +78 -0
- package/dist/rate/index.json +6 -0
- package/dist/rate/index.wxml +35 -0
- package/dist/rate/index.wxss +1 -0
- package/dist/row/index.d.ts +1 -0
- package/dist/row/index.js +23 -0
- package/dist/row/index.json +3 -0
- package/dist/row/index.wxml +5 -0
- package/dist/row/index.wxs +18 -0
- package/dist/row/index.wxss +1 -0
- package/dist/search/index.d.ts +1 -0
- package/dist/search/index.js +97 -0
- package/dist/search/index.json +6 -0
- package/dist/search/index.wxml +54 -0
- package/dist/search/index.wxss +1 -0
- package/dist/share-sheet/index.d.ts +1 -0
- package/dist/share-sheet/index.js +59 -0
- package/dist/share-sheet/index.json +7 -0
- package/dist/share-sheet/index.wxml +47 -0
- package/dist/share-sheet/index.wxs +12 -0
- package/dist/share-sheet/index.wxss +1 -0
- package/dist/share-sheet/options.d.ts +1 -0
- package/dist/share-sheet/options.js +14 -0
- package/dist/share-sheet/options.json +3 -0
- package/dist/share-sheet/options.wxml +20 -0
- package/dist/share-sheet/options.wxs +14 -0
- package/dist/share-sheet/options.wxss +1 -0
- package/dist/sidebar/index.d.ts +1 -0
- package/dist/sidebar/index.js +34 -0
- package/dist/sidebar/index.json +3 -0
- package/dist/sidebar/index.wxml +3 -0
- package/dist/sidebar/index.wxss +1 -0
- package/dist/sidebar-item/index.d.ts +1 -0
- package/dist/sidebar-item/index.js +29 -0
- package/dist/sidebar-item/index.json +6 -0
- package/dist/sidebar-item/index.wxml +18 -0
- package/dist/sidebar-item/index.wxss +1 -0
- package/dist/skeleton/index.d.ts +1 -0
- package/dist/skeleton/index.js +46 -0
- package/dist/skeleton/index.json +4 -0
- package/dist/skeleton/index.wxml +29 -0
- package/dist/skeleton/index.wxss +1 -0
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +207 -0
- package/dist/slider/index.json +3 -0
- package/dist/slider/index.wxml +68 -0
- package/dist/slider/index.wxs +14 -0
- package/dist/slider/index.wxss +1 -0
- package/dist/stepper/index.d.ts +1 -0
- package/dist/stepper/index.js +184 -0
- package/dist/stepper/index.json +3 -0
- package/dist/stepper/index.wxml +43 -0
- package/dist/stepper/index.wxs +22 -0
- package/dist/stepper/index.wxss +1 -0
- package/dist/steps/index.d.ts +1 -0
- package/dist/steps/index.js +33 -0
- package/dist/steps/index.json +6 -0
- package/dist/steps/index.wxml +54 -0
- package/dist/steps/index.wxss +1 -0
- package/dist/sticky/index.d.ts +1 -0
- package/dist/sticky/index.js +120 -0
- package/dist/sticky/index.json +3 -0
- package/dist/sticky/index.wxml +8 -0
- package/dist/sticky/index.wxs +25 -0
- package/dist/sticky/index.wxss +1 -0
- package/dist/submit-bar/index.d.ts +1 -0
- package/dist/submit-bar/index.js +56 -0
- package/dist/submit-bar/index.json +7 -0
- package/dist/submit-bar/index.wxml +44 -0
- package/dist/submit-bar/index.wxss +1 -0
- package/dist/swipe-cell/index.d.ts +1 -0
- package/dist/swipe-cell/index.js +133 -0
- package/dist/swipe-cell/index.json +3 -0
- package/dist/swipe-cell/index.wxml +20 -0
- package/dist/swipe-cell/index.wxss +1 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +36 -0
- package/dist/switch/index.json +6 -0
- package/dist/switch/index.wxml +16 -0
- package/dist/switch/index.wxs +26 -0
- package/dist/switch/index.wxss +1 -0
- package/dist/tab/index.d.ts +1 -0
- package/dist/tab/index.js +56 -0
- package/dist/tab/index.json +3 -0
- package/dist/tab/index.wxml +8 -0
- package/dist/tab/index.wxss +1 -0
- package/dist/tabbar/index.d.ts +1 -0
- package/dist/tabbar/index.js +65 -0
- package/dist/tabbar/index.json +3 -0
- package/dist/tabbar/index.wxml +10 -0
- package/dist/tabbar/index.wxss +1 -0
- package/dist/tabbar-item/index.d.ts +1 -0
- package/dist/tabbar-item/index.js +68 -0
- package/dist/tabbar-item/index.json +7 -0
- package/dist/tabbar-item/index.wxml +28 -0
- package/dist/tabbar-item/index.wxss +1 -0
- package/dist/tabs/index.d.ts +1 -0
- package/dist/tabs/index.js +302 -0
- package/dist/tabs/index.json +7 -0
- package/dist/tabs/index.wxml +63 -0
- package/dist/tabs/index.wxs +83 -0
- package/dist/tabs/index.wxss +1 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +21 -0
- package/dist/tag/index.json +6 -0
- package/dist/tag/index.wxml +15 -0
- package/dist/tag/index.wxs +13 -0
- package/dist/tag/index.wxss +1 -0
- package/dist/toast/index.d.ts +1 -0
- package/dist/toast/index.js +29 -0
- package/dist/toast/index.json +9 -0
- package/dist/toast/index.wxml +36 -0
- package/dist/toast/index.wxss +1 -0
- package/dist/toast/toast.d.ts +28 -0
- package/dist/toast/toast.js +68 -0
- package/dist/transition/index.d.ts +1 -0
- package/dist/transition/index.js +13 -0
- package/dist/transition/index.json +3 -0
- package/dist/transition/index.wxml +10 -0
- package/dist/transition/index.wxs +17 -0
- package/dist/transition/index.wxss +1 -0
- package/dist/tree-select/index.d.ts +1 -0
- package/dist/tree-select/index.js +68 -0
- package/dist/tree-select/index.json +8 -0
- package/dist/tree-select/index.wxml +41 -0
- package/dist/tree-select/index.wxs +12 -0
- package/dist/tree-select/index.wxss +1 -0
- package/dist/uploader/index.d.ts +1 -0
- package/dist/uploader/index.js +170 -0
- package/dist/uploader/index.json +7 -0
- package/dist/uploader/index.wxml +85 -0
- package/dist/uploader/index.wxs +17 -0
- package/dist/uploader/index.wxss +1 -0
- package/dist/uploader/shared.d.ts +61 -0
- package/dist/uploader/shared.js +65 -0
- package/dist/uploader/utils.d.ts +24 -0
- package/dist/uploader/utils.js +94 -0
- package/dist/wxs/add-unit.wxs +12 -0
- package/dist/wxs/array.wxs +5 -0
- package/dist/wxs/bem.wxs +39 -0
- package/dist/wxs/memoize.wxs +55 -0
- package/dist/wxs/object.wxs +13 -0
- package/dist/wxs/style.wxs +42 -0
- package/dist/wxs/utils.wxs +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { GREEN } from '../common/color';
|
|
2
|
+
import { VantComponent } from '../common/component';
|
|
3
|
+
import { useChildren } from '../common/relation';
|
|
4
|
+
import { getRect, isDef } from '../common/utils';
|
|
5
|
+
import { pageScrollMixin } from '../mixins/page-scroll';
|
|
6
|
+
const indexList = () => {
|
|
7
|
+
const indexList = [];
|
|
8
|
+
const charCodeOfA = 'A'.charCodeAt(0);
|
|
9
|
+
for (let i = 0; i < 26; i++) {
|
|
10
|
+
indexList.push(String.fromCharCode(charCodeOfA + i));
|
|
11
|
+
}
|
|
12
|
+
return indexList;
|
|
13
|
+
};
|
|
14
|
+
VantComponent({
|
|
15
|
+
relation: useChildren('index-anchor', function () {
|
|
16
|
+
this.updateData();
|
|
17
|
+
}),
|
|
18
|
+
props: {
|
|
19
|
+
sticky: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
value: true,
|
|
22
|
+
},
|
|
23
|
+
zIndex: {
|
|
24
|
+
type: Number,
|
|
25
|
+
value: 1,
|
|
26
|
+
},
|
|
27
|
+
highlightColor: {
|
|
28
|
+
type: String,
|
|
29
|
+
value: GREEN,
|
|
30
|
+
},
|
|
31
|
+
stickyOffsetTop: {
|
|
32
|
+
type: Number,
|
|
33
|
+
value: 0,
|
|
34
|
+
},
|
|
35
|
+
indexList: {
|
|
36
|
+
type: Array,
|
|
37
|
+
value: indexList(),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
mixins: [
|
|
41
|
+
pageScrollMixin(function (event) {
|
|
42
|
+
this.scrollTop = (event === null || event === void 0 ? void 0 : event.scrollTop) || 0;
|
|
43
|
+
this.onScroll();
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
data: {
|
|
47
|
+
activeAnchorIndex: null,
|
|
48
|
+
showSidebar: false,
|
|
49
|
+
},
|
|
50
|
+
created() {
|
|
51
|
+
this.scrollTop = 0;
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
updateData() {
|
|
55
|
+
wx.nextTick(() => {
|
|
56
|
+
if (this.timer != null) {
|
|
57
|
+
clearTimeout(this.timer);
|
|
58
|
+
}
|
|
59
|
+
this.timer = setTimeout(() => {
|
|
60
|
+
this.setData({
|
|
61
|
+
showSidebar: !!this.children.length,
|
|
62
|
+
});
|
|
63
|
+
this.setRect().then(() => {
|
|
64
|
+
this.onScroll();
|
|
65
|
+
});
|
|
66
|
+
}, 0);
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
setRect() {
|
|
70
|
+
return Promise.all([
|
|
71
|
+
this.setAnchorsRect(),
|
|
72
|
+
this.setListRect(),
|
|
73
|
+
this.setSiderbarRect(),
|
|
74
|
+
]);
|
|
75
|
+
},
|
|
76
|
+
setAnchorsRect() {
|
|
77
|
+
return Promise.all(this.children.map((anchor) => getRect(anchor, '.van-index-anchor-wrapper').then((rect) => {
|
|
78
|
+
Object.assign(anchor, {
|
|
79
|
+
height: rect.height,
|
|
80
|
+
top: rect.top + this.scrollTop,
|
|
81
|
+
});
|
|
82
|
+
})));
|
|
83
|
+
},
|
|
84
|
+
setListRect() {
|
|
85
|
+
return getRect(this, '.van-index-bar').then((rect) => {
|
|
86
|
+
if (!isDef(rect)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
Object.assign(this, {
|
|
90
|
+
height: rect.height,
|
|
91
|
+
top: rect.top + this.scrollTop,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
setSiderbarRect() {
|
|
96
|
+
return getRect(this, '.van-index-bar__sidebar').then((res) => {
|
|
97
|
+
if (!isDef(res)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.sidebar = {
|
|
101
|
+
height: res.height,
|
|
102
|
+
top: res.top,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
setDiffData({ target, data }) {
|
|
107
|
+
const diffData = {};
|
|
108
|
+
Object.keys(data).forEach((key) => {
|
|
109
|
+
if (target.data[key] !== data[key]) {
|
|
110
|
+
diffData[key] = data[key];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
if (Object.keys(diffData).length) {
|
|
114
|
+
target.setData(diffData);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
getAnchorRect(anchor) {
|
|
118
|
+
return getRect(anchor, '.van-index-anchor-wrapper').then((rect) => ({
|
|
119
|
+
height: rect.height,
|
|
120
|
+
top: rect.top,
|
|
121
|
+
}));
|
|
122
|
+
},
|
|
123
|
+
getActiveAnchorIndex() {
|
|
124
|
+
const { children, scrollTop } = this;
|
|
125
|
+
const { sticky, stickyOffsetTop } = this.data;
|
|
126
|
+
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
127
|
+
const preAnchorHeight = i > 0 ? children[i - 1].height : 0;
|
|
128
|
+
const reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0;
|
|
129
|
+
if (reachTop + scrollTop >= children[i].top) {
|
|
130
|
+
return i;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return -1;
|
|
134
|
+
},
|
|
135
|
+
onScroll() {
|
|
136
|
+
const { children = [], scrollTop } = this;
|
|
137
|
+
if (!children.length) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const { sticky, stickyOffsetTop, zIndex, highlightColor } = this.data;
|
|
141
|
+
const active = this.getActiveAnchorIndex();
|
|
142
|
+
this.setDiffData({
|
|
143
|
+
target: this,
|
|
144
|
+
data: {
|
|
145
|
+
activeAnchorIndex: active,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
if (sticky) {
|
|
149
|
+
let isActiveAnchorSticky = false;
|
|
150
|
+
if (active !== -1) {
|
|
151
|
+
isActiveAnchorSticky =
|
|
152
|
+
children[active].top <= stickyOffsetTop + scrollTop;
|
|
153
|
+
}
|
|
154
|
+
children.forEach((item, index) => {
|
|
155
|
+
if (index === active) {
|
|
156
|
+
let wrapperStyle = '';
|
|
157
|
+
let anchorStyle = `
|
|
158
|
+
color: ${highlightColor};
|
|
159
|
+
`;
|
|
160
|
+
if (isActiveAnchorSticky) {
|
|
161
|
+
wrapperStyle = `
|
|
162
|
+
height: ${children[index].height}px;
|
|
163
|
+
`;
|
|
164
|
+
anchorStyle = `
|
|
165
|
+
position: fixed;
|
|
166
|
+
top: ${stickyOffsetTop}px;
|
|
167
|
+
z-index: ${zIndex};
|
|
168
|
+
color: ${highlightColor};
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
this.setDiffData({
|
|
172
|
+
target: item,
|
|
173
|
+
data: {
|
|
174
|
+
active: true,
|
|
175
|
+
anchorStyle,
|
|
176
|
+
wrapperStyle,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else if (index === active - 1) {
|
|
181
|
+
const currentAnchor = children[index];
|
|
182
|
+
const currentOffsetTop = currentAnchor.top;
|
|
183
|
+
const targetOffsetTop = index === children.length - 1
|
|
184
|
+
? this.top
|
|
185
|
+
: children[index + 1].top;
|
|
186
|
+
const parentOffsetHeight = targetOffsetTop - currentOffsetTop;
|
|
187
|
+
const translateY = parentOffsetHeight - currentAnchor.height;
|
|
188
|
+
const anchorStyle = `
|
|
189
|
+
position: relative;
|
|
190
|
+
transform: translate3d(0, ${translateY}px, 0);
|
|
191
|
+
z-index: ${zIndex};
|
|
192
|
+
color: ${highlightColor};
|
|
193
|
+
`;
|
|
194
|
+
this.setDiffData({
|
|
195
|
+
target: item,
|
|
196
|
+
data: {
|
|
197
|
+
active: true,
|
|
198
|
+
anchorStyle,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
this.setDiffData({
|
|
204
|
+
target: item,
|
|
205
|
+
data: {
|
|
206
|
+
active: false,
|
|
207
|
+
anchorStyle: '',
|
|
208
|
+
wrapperStyle: '',
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
onClick(event) {
|
|
216
|
+
this.scrollToAnchor(event.target.dataset.index);
|
|
217
|
+
},
|
|
218
|
+
onTouchMove(event) {
|
|
219
|
+
const sidebarLength = this.children.length;
|
|
220
|
+
const touch = event.touches[0];
|
|
221
|
+
const itemHeight = this.sidebar.height / sidebarLength;
|
|
222
|
+
let index = Math.floor((touch.clientY - this.sidebar.top) / itemHeight);
|
|
223
|
+
if (index < 0) {
|
|
224
|
+
index = 0;
|
|
225
|
+
}
|
|
226
|
+
else if (index > sidebarLength - 1) {
|
|
227
|
+
index = sidebarLength - 1;
|
|
228
|
+
}
|
|
229
|
+
this.scrollToAnchor(index);
|
|
230
|
+
},
|
|
231
|
+
onTouchStop() {
|
|
232
|
+
this.scrollToAnchorIndex = null;
|
|
233
|
+
},
|
|
234
|
+
scrollToAnchor(index) {
|
|
235
|
+
if (typeof index !== 'number' || this.scrollToAnchorIndex === index) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this.scrollToAnchorIndex = index;
|
|
239
|
+
const anchor = this.children.find((item) => item.data.index === this.data.indexList[index]);
|
|
240
|
+
if (anchor) {
|
|
241
|
+
anchor.scrollIntoView(this.scrollTop);
|
|
242
|
+
this.$emit('select', anchor.data.index);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<view class="van-index-bar">
|
|
2
|
+
<slot />
|
|
3
|
+
|
|
4
|
+
<view
|
|
5
|
+
wx:if="{{ showSidebar }}"
|
|
6
|
+
class="van-index-bar__sidebar"
|
|
7
|
+
catch:tap="onClick"
|
|
8
|
+
catch:touchmove="onTouchMove"
|
|
9
|
+
catch:touchend="onTouchStop"
|
|
10
|
+
catch:touchcancel="onTouchStop"
|
|
11
|
+
>
|
|
12
|
+
<view
|
|
13
|
+
wx:for="{{ indexList }}"
|
|
14
|
+
wx:key="index"
|
|
15
|
+
class="van-index-bar__index"
|
|
16
|
+
style="z-index: {{ zIndex + 1 }}; color: {{ activeAnchorIndex === index ? highlightColor : '' }}"
|
|
17
|
+
data-index="{{ index }}"
|
|
18
|
+
>
|
|
19
|
+
{{ item }}
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../common/index.wxss';.van-index-bar{position:relative}.van-index-bar__sidebar{display:flex;flex-direction:column;position:fixed;right:0;text-align:center;top:50%;transform:translateY(-50%);-webkit-user-select:none;user-select:none}.van-index-bar__index{font-size:var(--index-bar-index-font-size,10px);font-weight:500;line-height:var(--index-bar-index-line-height,14px);padding:0 var(--padding-base,4px) 0 var(--padding-md,16px)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../common/index.wxss';.van-info{align-items:center;background-color:var(--info-background-color,#ee0a24);border:var(--info-border-width,1px) solid #fff;border-radius:var(--info-size,16px);box-sizing:border-box;color:var(--info-color,#fff);display:inline-flex;font-family:var(--info-font-family,-apple-system-font,Helvetica Neue,Arial,sans-serif);font-size:var(--info-font-size,12px);font-weight:var(--info-font-weight,500);height:var(--info-size,16px);justify-content:center;min-width:var(--info-size,16px);padding:var(--info-padding,0 3px);position:absolute;right:0;top:0;transform:translate(50%,-50%);transform-origin:100%;white-space:nowrap}.van-info--dot{background-color:var(--info-dot-color,#ee0a24);border-radius:100%;height:var(--info-dot-size,8px);min-width:0;width:var(--info-dot-size,8px)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VantComponent } from '../common/component';
|
|
2
|
+
VantComponent({
|
|
3
|
+
props: {
|
|
4
|
+
color: String,
|
|
5
|
+
vertical: Boolean,
|
|
6
|
+
type: {
|
|
7
|
+
type: String,
|
|
8
|
+
value: 'circular',
|
|
9
|
+
},
|
|
10
|
+
size: String,
|
|
11
|
+
textSize: String,
|
|
12
|
+
},
|
|
13
|
+
data: {
|
|
14
|
+
array12: Array.from({ length: 12 }),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<wxs src="../wxs/utils.wxs" module="utils" />
|
|
2
|
+
<wxs src="./index.wxs" module="computed" />
|
|
3
|
+
|
|
4
|
+
<view class="custom-class {{ utils.bem('loading', { vertical }) }}">
|
|
5
|
+
<view
|
|
6
|
+
class="van-loading__spinner van-loading__spinner--{{ type }}"
|
|
7
|
+
style="{{ computed.spinnerStyle({ color, size }) }}"
|
|
8
|
+
>
|
|
9
|
+
<view
|
|
10
|
+
wx:if="{{ type === 'spinner' }}"
|
|
11
|
+
wx:for="{{ array12 }}"
|
|
12
|
+
wx:key="index"
|
|
13
|
+
class="van-loading__dot"
|
|
14
|
+
/>
|
|
15
|
+
</view>
|
|
16
|
+
<view class="van-loading__text" style="{{ computed.textStyle({ textSize }) }}">
|
|
17
|
+
<slot />
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
var style = require('../wxs/style.wxs');
|
|
3
|
+
var addUnit = require('../wxs/add-unit.wxs');
|
|
4
|
+
|
|
5
|
+
function spinnerStyle(data) {
|
|
6
|
+
return style({
|
|
7
|
+
color: data.color,
|
|
8
|
+
width: addUnit(data.size),
|
|
9
|
+
height: addUnit(data.size),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function textStyle(data) {
|
|
14
|
+
return style({
|
|
15
|
+
'font-size': addUnit(data.textSize),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
spinnerStyle: spinnerStyle,
|
|
21
|
+
textStyle: textStyle,
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{align-items:center;color:var(--loading-spinner-color,#c8c9cc);display:inline-flex;justify-content:center}.van-loading__spinner{animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;box-sizing:border-box;height:var(--loading-spinner-size,30px);max-height:100%;max-width:100%;position:relative;width:var(--loading-spinner-size,30px)}.van-loading__spinner--spinner{animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-radius:100%;border-top-color:initial}.van-loading__text{color:var(--loading-text-color,#969799);font-size:var(--loading-text-font-size,14px);line-height:var(--loading-text-line-height,20px);margin-left:var(--padding-xs,8px)}.van-loading__text:empty{display:none}.van-loading--vertical{flex-direction:column}.van-loading--vertical .van-loading__text{margin:var(--padding-xs,8px) 0 0}.van-loading__dot{height:100%;left:0;position:absolute;top:0;width:100%}.van-loading__dot:before{background-color:currentColor;border-radius:40%;content:" ";display:block;height:25%;margin:0 auto;width:2px}.van-loading__dot:first-of-type{opacity:1;transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;transform:rotate(1turn)}@keyframes van-rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const basic: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const basic = Behavior({
|
|
2
|
+
methods: {
|
|
3
|
+
$emit(name, detail, options) {
|
|
4
|
+
this.triggerEvent(name, detail, options);
|
|
5
|
+
},
|
|
6
|
+
set(data) {
|
|
7
|
+
this.setData(data);
|
|
8
|
+
return new Promise((resolve) => wx.nextTick(resolve));
|
|
9
|
+
},
|
|
10
|
+
// high performance setData
|
|
11
|
+
setView(data, callback) {
|
|
12
|
+
const target = {};
|
|
13
|
+
let hasChange = false;
|
|
14
|
+
Object.keys(data).forEach((key) => {
|
|
15
|
+
if (data[key] !== this.data[key]) {
|
|
16
|
+
target[key] = data[key];
|
|
17
|
+
hasChange = true;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
if (hasChange) {
|
|
21
|
+
return this.setData(target, callback);
|
|
22
|
+
}
|
|
23
|
+
return callback && callback();
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const button: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { canIUseGetUserProfile } from '../common/version';
|
|
2
|
+
export const button = Behavior({
|
|
3
|
+
externalClasses: ['hover-class'],
|
|
4
|
+
properties: {
|
|
5
|
+
id: String,
|
|
6
|
+
buttonId: String,
|
|
7
|
+
lang: String,
|
|
8
|
+
businessId: Number,
|
|
9
|
+
sessionFrom: String,
|
|
10
|
+
sendMessageTitle: String,
|
|
11
|
+
sendMessagePath: String,
|
|
12
|
+
sendMessageImg: String,
|
|
13
|
+
showMessageCard: Boolean,
|
|
14
|
+
appParameter: String,
|
|
15
|
+
ariaLabel: String,
|
|
16
|
+
openType: String,
|
|
17
|
+
getUserProfileDesc: String,
|
|
18
|
+
},
|
|
19
|
+
data: {
|
|
20
|
+
canIUseGetUserProfile: canIUseGetUserProfile(),
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
onGetUserInfo(event) {
|
|
24
|
+
this.triggerEvent('getuserinfo', event.detail);
|
|
25
|
+
},
|
|
26
|
+
onContact(event) {
|
|
27
|
+
this.triggerEvent('contact', event.detail);
|
|
28
|
+
},
|
|
29
|
+
onGetPhoneNumber(event) {
|
|
30
|
+
this.triggerEvent('getphonenumber', event.detail);
|
|
31
|
+
},
|
|
32
|
+
onGetRealTimePhoneNumber(event) {
|
|
33
|
+
this.triggerEvent('getrealtimephonenumber', event.detail);
|
|
34
|
+
},
|
|
35
|
+
onError(event) {
|
|
36
|
+
this.triggerEvent('error', event.detail);
|
|
37
|
+
},
|
|
38
|
+
onLaunchApp(event) {
|
|
39
|
+
this.triggerEvent('launchapp', event.detail);
|
|
40
|
+
},
|
|
41
|
+
onOpenSetting(event) {
|
|
42
|
+
this.triggerEvent('opensetting', event.detail);
|
|
43
|
+
},
|
|
44
|
+
onAgreePrivacyAuthorization(event) {
|
|
45
|
+
this.triggerEvent('agreeprivacyauthorization', event.detail);
|
|
46
|
+
},
|
|
47
|
+
onChooseAvatar(event) {
|
|
48
|
+
this.triggerEvent('chooseavatar', event.detail);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const link: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const link = Behavior({
|
|
2
|
+
properties: {
|
|
3
|
+
url: String,
|
|
4
|
+
linkType: {
|
|
5
|
+
type: String,
|
|
6
|
+
value: 'navigateTo',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
methods: {
|
|
10
|
+
jumpLink(urlKey = 'url') {
|
|
11
|
+
const url = this.data[urlKey];
|
|
12
|
+
if (url) {
|
|
13
|
+
if (this.data.linkType === 'navigateTo' &&
|
|
14
|
+
getCurrentPages().length > 9) {
|
|
15
|
+
wx.redirectTo({ url });
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
wx[this.data.linkType]({ url });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="miniprogram-api-typings" />
|
|
2
|
+
/// <reference types="miniprogram-api-typings" />
|
|
3
|
+
type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
|
|
4
|
+
type Scroller = (this: WechatMiniprogram.Component.TrivialInstance, event?: IPageScrollOption) => void;
|
|
5
|
+
export declare function pageScrollMixin(scroller: Scroller): string;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isFunction } from '../common/validator';
|
|
2
|
+
import { getCurrentPage, isDef } from '../common/utils';
|
|
3
|
+
function onPageScroll(event) {
|
|
4
|
+
const { vanPageScroller = [] } = getCurrentPage();
|
|
5
|
+
vanPageScroller.forEach((scroller) => {
|
|
6
|
+
if (typeof scroller === 'function') {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
scroller(event);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function pageScrollMixin(scroller) {
|
|
13
|
+
return Behavior({
|
|
14
|
+
attached() {
|
|
15
|
+
const page = getCurrentPage();
|
|
16
|
+
if (!isDef(page)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const _scroller = scroller.bind(this);
|
|
20
|
+
const { vanPageScroller = [] } = page;
|
|
21
|
+
if (isFunction(page.onPageScroll) && page.onPageScroll !== onPageScroll) {
|
|
22
|
+
vanPageScroller.push(page.onPageScroll.bind(page));
|
|
23
|
+
}
|
|
24
|
+
vanPageScroller.push(_scroller);
|
|
25
|
+
page.vanPageScroller = vanPageScroller;
|
|
26
|
+
page.onPageScroll = onPageScroll;
|
|
27
|
+
this._scroller = _scroller;
|
|
28
|
+
},
|
|
29
|
+
detached() {
|
|
30
|
+
const page = getCurrentPage();
|
|
31
|
+
if (!isDef(page) || !isDef(page.vanPageScroller)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const { vanPageScroller } = page;
|
|
35
|
+
const index = vanPageScroller.findIndex((v) => v === this._scroller);
|
|
36
|
+
if (index > -1) {
|
|
37
|
+
page.vanPageScroller.splice(index, 1);
|
|
38
|
+
}
|
|
39
|
+
this._scroller = undefined;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const touch: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
const MIN_DISTANCE = 10;
|
|
3
|
+
function getDirection(x, y) {
|
|
4
|
+
if (x > y && x > MIN_DISTANCE) {
|
|
5
|
+
return 'horizontal';
|
|
6
|
+
}
|
|
7
|
+
if (y > x && y > MIN_DISTANCE) {
|
|
8
|
+
return 'vertical';
|
|
9
|
+
}
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
export const touch = Behavior({
|
|
13
|
+
methods: {
|
|
14
|
+
resetTouchStatus() {
|
|
15
|
+
this.direction = '';
|
|
16
|
+
this.deltaX = 0;
|
|
17
|
+
this.deltaY = 0;
|
|
18
|
+
this.offsetX = 0;
|
|
19
|
+
this.offsetY = 0;
|
|
20
|
+
},
|
|
21
|
+
touchStart(event) {
|
|
22
|
+
this.resetTouchStatus();
|
|
23
|
+
const touch = event.touches[0];
|
|
24
|
+
this.startX = touch.clientX;
|
|
25
|
+
this.startY = touch.clientY;
|
|
26
|
+
},
|
|
27
|
+
touchMove(event) {
|
|
28
|
+
const touch = event.touches[0];
|
|
29
|
+
this.deltaX = touch.clientX - this.startX;
|
|
30
|
+
this.deltaY = touch.clientY - this.startY;
|
|
31
|
+
this.offsetX = Math.abs(this.deltaX);
|
|
32
|
+
this.offsetY = Math.abs(this.deltaY);
|
|
33
|
+
this.direction =
|
|
34
|
+
this.direction || getDirection(this.offsetX, this.offsetY);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transition(showDefaultValue: boolean): string;
|