@kengic/uni 0.6.3-beta.4 → 0.6.3-beta.42
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/{dist/api → api}/WMS/Controllers/CommonController/GetLatestApkVersion.ts +21 -21
- package/{dist/api → api}/WMS/Controllers/CommonController/index.ts +1 -1
- package/{dist/api → api}/WMS/Controllers/LoginController/GetUserInfo.ts +21 -21
- package/{dist/api → api}/WMS/Controllers/LoginController/Logout.ts +21 -21
- package/{dist/api → api}/WMS/Controllers/LoginController/index.ts +2 -2
- package/{dist/api → api}/WMS/Controllers/WhController/ListVO.ts +88 -88
- package/{dist/api → api}/WMS/Controllers/WhController/index.ts +1 -1
- package/{dist/api → api}/WMS/Controllers/WorkstationController/List.ts +45 -45
- package/{dist/api → api}/WMS/Controllers/WorkstationController/index.ts +1 -1
- package/{dist/api → api}/WMS/Controllers/index.ts +4 -4
- package/{dist/api → api}/WMS/index.ts +2 -2
- package/{dist/api → api}/WMS/models.ts +342 -318
- package/{dist/api → api}/api.ts +1 -1
- package/{dist/api → api}/def.ts +1 -1
- package/{dist/api → api}/index.ts +2 -2
- package/{dist/component → component}/KgStation/KgStation.vue +120 -9
- package/{dist/component → component}/KgStation/index.hooks.ts +1 -1
- package/{dist/component → component}/KgUpdatePopup/KgUpdatePopup.vue +1 -1
- package/{dist/component → component}/KgWarehouse/KgWarehouse.vue +1 -1
- package/{dist/const → const}/index.vm.ts +10 -0
- package/index.css +73 -0
- package/lodash-es.ts +1 -0
- package/package.json +10 -44
- package/{dist/service → service}/http-client.ts +109 -63
- package/{dist/store → store}/app.store.ts +12 -0
- package/{dist/uni → uni}/uni-ui/uni-data-select/uni-data-select.vue +5 -4
- package/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1071 -0
- package/{dist/uni → uni}/uni-ui/uni-easyinput/common.js +1 -0
- package/{dist/uni → uni}/uni-ui/uni-easyinput/uni-easyinput.vue +23 -70
- package/{dist/uni → uni}/uni-ui/uni-pagination/uni-pagination.vue +8 -4
- package/{dist/uni → uni}/uni-ui/uni-segmented-control/uni-segmented-control.vue +4 -4
- package/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +403 -0
- package/{dist/util → util}/kg.ts +62 -14
- package/CHANGELOG.md +0 -15
- package/README.md +0 -1
- package/dist/index.css +0 -28
- package/dist/src/index.d.ts +0 -1
- package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +0 -1026
- package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +0 -347
- package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +0 -341
- /package/{dist/component → component}/KgNavBar/KgNavBar.vue +0 -0
- /package/{dist/component → component}/KgNavBar/index.ts +0 -0
- /package/{dist/component → component}/KgStation/index.store.ts +0 -0
- /package/{dist/component → component}/KgStation/index.ts +0 -0
- /package/{dist/component → component}/KgTabBar/KgTabBar.vue +0 -0
- /package/{dist/component → component}/KgTabBar/index.ts +0 -0
- /package/{dist/component → component}/KgUpdatePopup/index.ts +0 -0
- /package/{dist/component → component}/KgWarehouse/index.hooks.ts +0 -0
- /package/{dist/component → component}/KgWarehouse/index.store.ts +0 -0
- /package/{dist/component → component}/KgWarehouse/index.ts +0 -0
- /package/{dist/component → component}/index.ts +0 -0
- /package/{dist/config → config}/index.ts +0 -0
- /package/{dist/config → config}/setup.ts +0 -0
- /package/{dist/const → const}/index.ts +0 -0
- /package/{dist/index.ts → index.ts} +0 -0
- /package/{dist/service → service}/index.ts +0 -0
- /package/{dist/uni → uni}/index.ts +0 -0
- /package/{dist/uni → uni}/uni-ui/README.md +0 -0
- /package/{dist/uni → uni}/uni-ui/index.ts +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-badge/uni-badge.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/calendar.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/uni-calendar-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/uni-calendar.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-calendar/util.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-card/uni-card.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-col/uni-col.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-collapse/uni-collapse.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-collapse-item/uni-collapse-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-combox/uni-combox.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-countdown/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-countdown/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-countdown/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-countdown/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-countdown/uni-countdown.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-data-picker/keypress.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-data-picker/uni-data-picker.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-data-pickerview/uni-data-picker.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-dateformat/date-format.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-dateformat/uni-dateformat.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/calendar-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/calendar.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/time-picker.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-datetime-picker/util.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-drawer/keypress.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-drawer/uni-drawer.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-fab/uni-fab.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-fav/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-fav/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-fav/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-fav/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-fav/uni-fav.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-file-picker/choose-and-upload-file.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-file-picker/uni-file-picker.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-file-picker/upload-file.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-file-picker/upload-image.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-file-picker/utils.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-forms/uni-forms.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-forms/utils.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-forms/validate.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-forms-item/uni-forms-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-goods-nav/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-goods-nav/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-goods-nav/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-goods-nav/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-goods-nav/uni-goods-nav.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-grid/uni-grid.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-grid-item/uni-grid-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-group/uni-group.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-icons/icons.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-icons/uni-icons.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-icons/uniicons.css +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-icons/uniicons.ttf +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-icons/uniicons_file.ts +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-icons/uniicons_file_vue.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-indexed-list/uni-indexed-list.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-link/uni-link.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list/uni-list.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list/uni-refresh.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list/uni-refresh.wxs +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list-ad/uni-list-ad.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list-chat/uni-list-chat.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list-chat/uni-list-chat.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-list-item/uni-list-item.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-load-more/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-load-more/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-load-more/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-load-more/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-load-more/uni-load-more.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-nav-bar/uni-nav-bar.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-nav-bar/uni-status-bar.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-notice-bar/uni-notice-bar.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-number-box/uni-number-box.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-pagination/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-pagination/i18n/es.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-pagination/i18n/fr.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-pagination/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-pagination/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-pagination/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/keypress.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/popup.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup/uni-popup.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup-dialog/keypress.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup-message/uni-popup-message.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-popup-share/uni-popup-share.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-rate/uni-rate.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-row/uni-row.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/changelog.md +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/index.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/package.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/readme.md +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/index.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_border.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_color.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_radius.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_space.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_styles.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_text.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/setting/_variables.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/styles/tools/functions.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/theme.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-scss/variables.scss +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-search-bar/i18n/en.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-search-bar/i18n/index.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-search-bar/i18n/zh-Hans.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-search-bar/i18n/zh-Hant.json +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-search-bar/uni-search-bar.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-section/uni-section.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-steps/uni-steps.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action/uni-swipe-action.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action-item/bindingx.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action-item/isPC.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action-item/mpalipay.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action-item/mpother.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action-item/mpwxs.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swipe-action-item/render.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-table/uni-table.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-tag/uni-tag.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-tbody/uni-tbody.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-td/uni-td.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-th/filter-dropdown.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-th/uni-th.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-thead/uni-thead.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-title/uni-title.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-tooltip/uni-tooltip.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-tr/table-checkbox.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-tr/uni-tr.vue +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-transition/createAnimation.js +0 -0
- /package/{dist/uni → uni}/uni-ui/uni-transition/uni-transition.vue +0 -0
- /package/{dist/util → util}/index.ts +0 -0
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
|
|
3
|
-
<!-- #ifdef APP-VUE || MP-WEIXIN || H5 -->
|
|
4
|
-
<view class="uni-swipe">
|
|
5
|
-
<!-- #ifdef MP-WEIXIN || VUE3 -->
|
|
6
|
-
<view class="uni-swipe_box" :change:prop="wxsswipe.showWatch" :prop="is_show" :data-threshold="threshold"
|
|
7
|
-
:data-disabled="disabled" @touchstart="wxsswipe.touchstart" @touchmove="wxsswipe.touchmove"
|
|
8
|
-
@touchend="wxsswipe.touchend">
|
|
9
|
-
<!-- #endif -->
|
|
10
|
-
<!-- #ifndef MP-WEIXIN || VUE3 -->
|
|
11
|
-
<view class="uni-swipe_box" :change:prop="renderswipe.showWatch" :prop="is_show" :data-threshold="threshold"
|
|
12
|
-
:data-disabled="disabled+''" @touchstart="renderswipe.touchstart" @touchmove="renderswipe.touchmove"
|
|
13
|
-
@touchend="renderswipe.touchend">
|
|
14
|
-
<!-- #endif -->
|
|
15
|
-
<!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
|
|
16
|
-
<view class="uni-swipe_button-group button-group--left">
|
|
17
|
-
<slot name="left">
|
|
18
|
-
<view v-for="(item,index) in leftOptions" :key="index" :style="{
|
|
19
|
-
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
|
|
20
|
-
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
|
|
21
|
-
@touchend="appTouchEnd($event,index,item,'left')"
|
|
22
|
-
@click.stop="onClickForPC(index,item,'left')">
|
|
23
|
-
<text class="uni-swipe_button-text"
|
|
24
|
-
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
|
|
25
|
-
</view>
|
|
26
|
-
</slot>
|
|
27
|
-
</view>
|
|
28
|
-
<view class="uni-swipe_text--center">
|
|
29
|
-
<slot></slot>
|
|
30
|
-
</view>
|
|
31
|
-
<view class="uni-swipe_button-group button-group--right">
|
|
32
|
-
<slot name="right">
|
|
33
|
-
<view v-for="(item,index) in rightOptions" :key="index" :style="{
|
|
34
|
-
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
|
|
35
|
-
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
|
|
36
|
-
@touchend="appTouchEnd($event,index,item,'right')"
|
|
37
|
-
@click.stop="onClickForPC(index,item,'right')"><text class="uni-swipe_button-text"
|
|
38
|
-
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
|
|
39
|
-
</view>
|
|
40
|
-
</slot>
|
|
41
|
-
</view>
|
|
42
|
-
</view>
|
|
43
|
-
</view>
|
|
44
|
-
<!-- #endif -->
|
|
45
|
-
<!-- app nvue端 使用 bindingx -->
|
|
46
|
-
<!-- #ifdef APP-NVUE -->
|
|
47
|
-
<view ref="selector-box--hock" class="uni-swipe" @horizontalpan="touchstart" @touchend="touchend">
|
|
48
|
-
<view ref='selector-left-button--hock' class="uni-swipe_button-group button-group--left">
|
|
49
|
-
<slot name="left">
|
|
50
|
-
<view v-for="(item,index) in leftOptions" :key="index" :style="{
|
|
51
|
-
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
|
|
52
|
-
}" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'left')"><text
|
|
53
|
-
class="uni-swipe_button-text"
|
|
54
|
-
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
|
|
55
|
-
</view>
|
|
56
|
-
</slot>
|
|
57
|
-
</view>
|
|
58
|
-
<view ref='selector-right-button--hock' class="uni-swipe_button-group button-group--right">
|
|
59
|
-
<slot name="right">
|
|
60
|
-
<view v-for="(item,index) in rightOptions" :key="index" :style="{
|
|
61
|
-
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
|
|
62
|
-
}" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'right')"><text
|
|
63
|
-
class="uni-swipe_button-text"
|
|
64
|
-
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
|
|
65
|
-
</view>
|
|
66
|
-
</slot>
|
|
67
|
-
</view>
|
|
68
|
-
<view ref='selector-content--hock' class="uni-swipe_box">
|
|
69
|
-
<slot></slot>
|
|
70
|
-
</view>
|
|
71
|
-
</view>
|
|
72
|
-
<!-- #endif -->
|
|
73
|
-
<!-- 其他平台使用 js ,长列表性能可能会有影响-->
|
|
74
|
-
<!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ -->
|
|
75
|
-
<view class="uni-swipe">
|
|
76
|
-
<view class="uni-swipe_box" @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend"
|
|
77
|
-
:style="{transform:moveLeft}" :class="{ani:ani}">
|
|
78
|
-
<view class="uni-swipe_button-group button-group--left" :class="[elClass]">
|
|
79
|
-
<slot name="left">
|
|
80
|
-
<view v-for="(item,index) in leftOptions" :key="index" :style="{
|
|
81
|
-
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
|
82
|
-
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
|
83
|
-
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
|
|
84
|
-
@touchend="appTouchEnd($event,index,item,'left')"><text class="uni-swipe_button-text"
|
|
85
|
-
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
|
86
|
-
</view>
|
|
87
|
-
</slot>
|
|
88
|
-
</view>
|
|
89
|
-
<slot></slot>
|
|
90
|
-
<view class="uni-swipe_button-group button-group--right" :class="[elClass]">
|
|
91
|
-
<slot name="right">
|
|
92
|
-
<view v-for="(item,index) in rightOptions" :key="index" :style="{
|
|
93
|
-
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
|
|
94
|
-
fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
|
|
95
|
-
}" @touchstart="appTouchStart" @touchend="appTouchEnd($event,index,item,'right')"
|
|
96
|
-
class="uni-swipe_button button-hock"><text class="uni-swipe_button-text"
|
|
97
|
-
:style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
|
|
98
|
-
</view>
|
|
99
|
-
</slot>
|
|
100
|
-
</view>
|
|
101
|
-
</view>
|
|
102
|
-
</view>
|
|
103
|
-
<!-- #endif -->
|
|
104
|
-
|
|
105
|
-
</template>
|
|
106
|
-
<script src='./wx.wxs' module="wxsswipe" lang="wxs"></script>
|
|
107
|
-
|
|
108
|
-
<script module="renderswipe" lang="renderjs">
|
|
109
|
-
import render from './render.js'
|
|
110
|
-
export default {
|
|
111
|
-
mounted(e, ins, owner) {
|
|
112
|
-
this.state = {}
|
|
113
|
-
},
|
|
114
|
-
methods: {
|
|
115
|
-
showWatch(newVal, oldVal, ownerInstance, instance) {
|
|
116
|
-
render.showWatch(newVal, oldVal, ownerInstance, instance, this)
|
|
117
|
-
},
|
|
118
|
-
touchstart(e, ownerInstance) {
|
|
119
|
-
render.touchstart(e, ownerInstance, this)
|
|
120
|
-
},
|
|
121
|
-
touchmove(e, ownerInstance) {
|
|
122
|
-
render.touchmove(e, ownerInstance, this)
|
|
123
|
-
},
|
|
124
|
-
touchend(e, ownerInstance) {
|
|
125
|
-
render.touchend(e, ownerInstance, this)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
</script>
|
|
130
|
-
<script>
|
|
131
|
-
import mpwxs from './mpwxs'
|
|
132
|
-
import bindingx from './bindingx.js'
|
|
133
|
-
import mpother from './mpother'
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* SwipeActionItem 滑动操作子组件
|
|
137
|
-
* @description 通过滑动触发选项的容器
|
|
138
|
-
* @tutorial https://ext.dcloud.net.cn/plugin?id=181
|
|
139
|
-
* @property {Boolean} show = [left|right|none] 开启关闭组件,auto-close = false 时生效
|
|
140
|
-
* @property {Boolean} disabled = [true|false] 是否禁止滑动
|
|
141
|
-
* @property {Boolean} autoClose = [true|false] 滑动打开当前组件,是否关闭其他组件
|
|
142
|
-
* @property {Number} threshold 滑动缺省值
|
|
143
|
-
* @property {Array} leftOptions 左侧选项内容及样式
|
|
144
|
-
* @property {Array} rgihtOptions 右侧选项内容及样式
|
|
145
|
-
* @event {Function} click 点击选项按钮时触发事件,e = {content,index} ,content(点击内容)、index(下标)
|
|
146
|
-
* @event {Function} change 组件打开或关闭时触发,left\right\none
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
export default {
|
|
150
|
-
mixins: [mpwxs, bindingx, mpother],
|
|
151
|
-
emits: ['click', 'change'],
|
|
152
|
-
props: {
|
|
153
|
-
// 控制开关
|
|
154
|
-
show: {
|
|
155
|
-
type: String,
|
|
156
|
-
default: 'none'
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
// 禁用
|
|
160
|
-
disabled: {
|
|
161
|
-
type: Boolean,
|
|
162
|
-
default: false
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
// 是否自动关闭
|
|
166
|
-
autoClose: {
|
|
167
|
-
type: Boolean,
|
|
168
|
-
default: true
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
// 滑动缺省距离
|
|
172
|
-
threshold: {
|
|
173
|
-
type: Number,
|
|
174
|
-
default: 20
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
// 左侧按钮内容
|
|
178
|
-
leftOptions: {
|
|
179
|
-
type: Array,
|
|
180
|
-
default () {
|
|
181
|
-
return []
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
// 右侧按钮内容
|
|
186
|
-
rightOptions: {
|
|
187
|
-
type: Array,
|
|
188
|
-
default () {
|
|
189
|
-
return []
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
// #ifndef VUE3
|
|
195
|
-
// TODO vue2
|
|
196
|
-
destroyed() {
|
|
197
|
-
if (this.__isUnmounted) return
|
|
198
|
-
this.uninstall()
|
|
199
|
-
},
|
|
200
|
-
// #endif
|
|
201
|
-
// #ifdef VUE3
|
|
202
|
-
// TODO vue3
|
|
203
|
-
unmounted() {
|
|
204
|
-
this.__isUnmounted = true
|
|
205
|
-
this.uninstall()
|
|
206
|
-
},
|
|
207
|
-
// #endif
|
|
208
|
-
|
|
209
|
-
methods: {
|
|
210
|
-
uninstall() {
|
|
211
|
-
if (this.swipeaction) {
|
|
212
|
-
this.swipeaction.children.forEach((item, index) => {
|
|
213
|
-
if (item === this) {
|
|
214
|
-
this.swipeaction.children.splice(index, 1)
|
|
215
|
-
}
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
/**
|
|
220
|
-
* 获取父元素实例
|
|
221
|
-
*/
|
|
222
|
-
getSwipeAction(name = 'uniSwipeAction') {
|
|
223
|
-
let parent = this.$parent;
|
|
224
|
-
let parentName = parent.$options.name;
|
|
225
|
-
while (parentName !== name) {
|
|
226
|
-
parent = parent.$parent;
|
|
227
|
-
if (!parent) return false;
|
|
228
|
-
parentName = parent.$options.name;
|
|
229
|
-
}
|
|
230
|
-
return parent;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
</script>
|
|
235
|
-
<style lang="scss">
|
|
236
|
-
.uni-swipe {
|
|
237
|
-
position: relative;
|
|
238
|
-
/* #ifndef APP-NVUE */
|
|
239
|
-
overflow: hidden;
|
|
240
|
-
/* #endif */
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.uni-swipe_box {
|
|
244
|
-
/* #ifndef APP-NVUE */
|
|
245
|
-
display: flex;
|
|
246
|
-
flex-shrink: 0;
|
|
247
|
-
// touch-action: none;
|
|
248
|
-
/* #endif */
|
|
249
|
-
position: relative;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.uni-swipe_content {
|
|
253
|
-
// border: 1px red solid;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.uni-swipe_text--center {
|
|
257
|
-
width: 100%;
|
|
258
|
-
/* #ifndef APP-NVUE */
|
|
259
|
-
cursor: grab;
|
|
260
|
-
/* #endif */
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.uni-swipe_button-group {
|
|
264
|
-
/* #ifndef APP-NVUE */
|
|
265
|
-
box-sizing: border-box;
|
|
266
|
-
display: flex;
|
|
267
|
-
/* #endif */
|
|
268
|
-
flex-direction: row;
|
|
269
|
-
position: absolute;
|
|
270
|
-
top: 0;
|
|
271
|
-
bottom: 0;
|
|
272
|
-
/* #ifdef H5 */
|
|
273
|
-
cursor: pointer;
|
|
274
|
-
/* #endif */
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.button-group--left {
|
|
278
|
-
left: 0;
|
|
279
|
-
transform: translateX(-100%)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.button-group--right {
|
|
283
|
-
right: 0;
|
|
284
|
-
transform: translateX(100%)
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.uni-swipe_button {
|
|
288
|
-
/* #ifdef APP-NVUE */
|
|
289
|
-
flex: 1;
|
|
290
|
-
/* #endif */
|
|
291
|
-
/* #ifndef APP-NVUE */
|
|
292
|
-
display: flex;
|
|
293
|
-
/* #endif */
|
|
294
|
-
flex-direction: row;
|
|
295
|
-
justify-content: center;
|
|
296
|
-
align-items: center;
|
|
297
|
-
padding: 0 20px;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.uni-swipe_button-text {
|
|
301
|
-
/* #ifndef APP-NVUE */
|
|
302
|
-
flex-shrink: 0;
|
|
303
|
-
/* #endif */
|
|
304
|
-
font-size: 14px;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.ani {
|
|
308
|
-
transition-property: transform;
|
|
309
|
-
transition-duration: 0.3s;
|
|
310
|
-
transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/* #ifdef MP-ALIPAY */
|
|
314
|
-
.movable-area {
|
|
315
|
-
/* width: 100%; */
|
|
316
|
-
height: 45px;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.movable-view {
|
|
320
|
-
display: flex;
|
|
321
|
-
/* justify-content: center; */
|
|
322
|
-
position: relative;
|
|
323
|
-
flex: 1;
|
|
324
|
-
height: 45px;
|
|
325
|
-
z-index: 2;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.movable-view-button {
|
|
329
|
-
display: flex;
|
|
330
|
-
flex-shrink: 0;
|
|
331
|
-
flex-direction: row;
|
|
332
|
-
height: 100%;
|
|
333
|
-
background: #C0C0C0;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/* .transition {
|
|
337
|
-
transition: all 0.3s;
|
|
338
|
-
} */
|
|
339
|
-
|
|
340
|
-
.movable-view-box {
|
|
341
|
-
flex-shrink: 0;
|
|
342
|
-
height: 100%;
|
|
343
|
-
background-color: #fff;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/* #endif */
|
|
347
|
-
</style>
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
var MIN_DISTANCE = 10;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 判断当前是否为H5、app-vue
|
|
5
|
-
*/
|
|
6
|
-
var IS_HTML5 = false
|
|
7
|
-
if (typeof window === 'object') IS_HTML5 = true
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 监听页面内值的变化,主要用于动态开关swipe-action
|
|
11
|
-
* @param {Object} newValue
|
|
12
|
-
* @param {Object} oldValue
|
|
13
|
-
* @param {Object} ownerInstance
|
|
14
|
-
* @param {Object} instance
|
|
15
|
-
*/
|
|
16
|
-
function showWatch(newVal, oldVal, ownerInstance, instance) {
|
|
17
|
-
var state = instance.getState()
|
|
18
|
-
getDom(instance, ownerInstance)
|
|
19
|
-
if (newVal && newVal !== 'none') {
|
|
20
|
-
openState(newVal, instance, ownerInstance)
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (state.left) {
|
|
25
|
-
openState('none', instance, ownerInstance)
|
|
26
|
-
}
|
|
27
|
-
resetTouchStatus(instance)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 开始触摸操作
|
|
32
|
-
* @param {Object} e
|
|
33
|
-
* @param {Object} ins
|
|
34
|
-
*/
|
|
35
|
-
function touchstart(e, ownerInstance) {
|
|
36
|
-
var instance = e.instance;
|
|
37
|
-
var disabled = instance.getDataset().disabled
|
|
38
|
-
var state = instance.getState();
|
|
39
|
-
getDom(instance, ownerInstance)
|
|
40
|
-
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
|
41
|
-
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
|
|
42
|
-
if (disabled) return
|
|
43
|
-
// 开始触摸时移除动画类
|
|
44
|
-
instance.requestAnimationFrame(function() {
|
|
45
|
-
instance.removeClass('ani');
|
|
46
|
-
ownerInstance.callMethod('closeSwipe');
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
// 记录上次的位置
|
|
50
|
-
state.x = state.left || 0
|
|
51
|
-
// 计算滑动开始位置
|
|
52
|
-
stopTouchStart(e, ownerInstance)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 开始滑动操作
|
|
57
|
-
* @param {Object} e
|
|
58
|
-
* @param {Object} ownerInstance
|
|
59
|
-
*/
|
|
60
|
-
function touchmove(e, ownerInstance) {
|
|
61
|
-
var instance = e.instance;
|
|
62
|
-
var disabled = instance.getDataset().disabled
|
|
63
|
-
var state = instance.getState()
|
|
64
|
-
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
|
65
|
-
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
|
|
66
|
-
if (disabled) return
|
|
67
|
-
// 是否可以滑动页面
|
|
68
|
-
stopTouchMove(e);
|
|
69
|
-
if (state.direction !== 'horizontal') {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (e.preventDefault) {
|
|
74
|
-
// 阻止页面滚动
|
|
75
|
-
e.preventDefault()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
move(state.x + state.deltaX, instance, ownerInstance)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* 结束触摸操作
|
|
83
|
-
* @param {Object} e
|
|
84
|
-
* @param {Object} ownerInstance
|
|
85
|
-
*/
|
|
86
|
-
function touchend(e, ownerInstance) {
|
|
87
|
-
var instance = e.instance;
|
|
88
|
-
var disabled = instance.getDataset().disabled
|
|
89
|
-
var state = instance.getState()
|
|
90
|
-
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
|
|
91
|
-
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
|
|
92
|
-
|
|
93
|
-
if (disabled) return
|
|
94
|
-
// 滑动过程中触摸结束,通过阙值判断是开启还是关闭
|
|
95
|
-
// fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
|
|
96
|
-
moveDirection(state.left, instance, ownerInstance)
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 设置移动距离
|
|
102
|
-
* @param {Object} value
|
|
103
|
-
* @param {Object} instance
|
|
104
|
-
* @param {Object} ownerInstance
|
|
105
|
-
*/
|
|
106
|
-
function move(value, instance, ownerInstance) {
|
|
107
|
-
value = value || 0
|
|
108
|
-
var state = instance.getState()
|
|
109
|
-
var leftWidth = state.leftWidth
|
|
110
|
-
var rightWidth = state.rightWidth
|
|
111
|
-
// 获取可滑动范围
|
|
112
|
-
state.left = range(value, -rightWidth, leftWidth);
|
|
113
|
-
instance.requestAnimationFrame(function() {
|
|
114
|
-
instance.setStyle({
|
|
115
|
-
transform: 'translateX(' + state.left + 'px)',
|
|
116
|
-
'-webkit-transform': 'translateX(' + state.left + 'px)'
|
|
117
|
-
})
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* 获取元素信息
|
|
124
|
-
* @param {Object} instance
|
|
125
|
-
* @param {Object} ownerInstance
|
|
126
|
-
*/
|
|
127
|
-
function getDom(instance, ownerInstance) {
|
|
128
|
-
var state = instance.getState()
|
|
129
|
-
var leftDom = ownerInstance.selectComponent('.button-group--left')
|
|
130
|
-
var rightDom = ownerInstance.selectComponent('.button-group--right')
|
|
131
|
-
var leftStyles = {
|
|
132
|
-
width: 0
|
|
133
|
-
}
|
|
134
|
-
var rightStyles = {
|
|
135
|
-
width: 0
|
|
136
|
-
}
|
|
137
|
-
leftStyles = leftDom.getBoundingClientRect()
|
|
138
|
-
rightStyles = rightDom.getBoundingClientRect()
|
|
139
|
-
|
|
140
|
-
state.leftWidth = leftStyles.width || 0
|
|
141
|
-
state.rightWidth = rightStyles.width || 0
|
|
142
|
-
state.threshold = instance.getDataset().threshold
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 获取范围
|
|
147
|
-
* @param {Object} num
|
|
148
|
-
* @param {Object} min
|
|
149
|
-
* @param {Object} max
|
|
150
|
-
*/
|
|
151
|
-
function range(num, min, max) {
|
|
152
|
-
return Math.min(Math.max(num, min), max);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* 移动方向判断
|
|
158
|
-
* @param {Object} left
|
|
159
|
-
* @param {Object} value
|
|
160
|
-
* @param {Object} ownerInstance
|
|
161
|
-
* @param {Object} ins
|
|
162
|
-
*/
|
|
163
|
-
function moveDirection(left, ins, ownerInstance) {
|
|
164
|
-
var state = ins.getState()
|
|
165
|
-
var threshold = state.threshold
|
|
166
|
-
var position = state.position
|
|
167
|
-
var isopen = state.isopen || 'none'
|
|
168
|
-
var leftWidth = state.leftWidth
|
|
169
|
-
var rightWidth = state.rightWidth
|
|
170
|
-
if (state.deltaX === 0) {
|
|
171
|
-
openState('none', ins, ownerInstance)
|
|
172
|
-
return
|
|
173
|
-
}
|
|
174
|
-
if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
|
|
175
|
-
rightWidth +
|
|
176
|
-
left < threshold)) {
|
|
177
|
-
// right
|
|
178
|
-
openState('right', ins, ownerInstance)
|
|
179
|
-
} else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
|
|
180
|
-
leftWidth - left < threshold)) {
|
|
181
|
-
// left
|
|
182
|
-
openState('left', ins, ownerInstance)
|
|
183
|
-
} else {
|
|
184
|
-
// default
|
|
185
|
-
openState('none', ins, ownerInstance)
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* 开启状态
|
|
192
|
-
* @param {Boolean} type
|
|
193
|
-
* @param {Object} ins
|
|
194
|
-
* @param {Object} ownerInstance
|
|
195
|
-
*/
|
|
196
|
-
function openState(type, ins, ownerInstance) {
|
|
197
|
-
var state = ins.getState()
|
|
198
|
-
var leftWidth = state.leftWidth
|
|
199
|
-
var rightWidth = state.rightWidth
|
|
200
|
-
var left = ''
|
|
201
|
-
state.isopen = state.isopen ? state.isopen : 'none'
|
|
202
|
-
switch (type) {
|
|
203
|
-
case "left":
|
|
204
|
-
left = leftWidth
|
|
205
|
-
break
|
|
206
|
-
case "right":
|
|
207
|
-
left = -rightWidth
|
|
208
|
-
break
|
|
209
|
-
default:
|
|
210
|
-
left = 0
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// && !state.throttle
|
|
214
|
-
|
|
215
|
-
if (state.isopen !== type) {
|
|
216
|
-
state.throttle = true
|
|
217
|
-
ownerInstance.callMethod('change', {
|
|
218
|
-
open: type
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
state.isopen = type
|
|
224
|
-
// 添加动画类
|
|
225
|
-
ins.requestAnimationFrame(function() {
|
|
226
|
-
ins.addClass('ani');
|
|
227
|
-
move(left, ins, ownerInstance)
|
|
228
|
-
})
|
|
229
|
-
// 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
function getDirection(x, y) {
|
|
234
|
-
if (x > y && x > MIN_DISTANCE) {
|
|
235
|
-
return 'horizontal';
|
|
236
|
-
}
|
|
237
|
-
if (y > x && y > MIN_DISTANCE) {
|
|
238
|
-
return 'vertical';
|
|
239
|
-
}
|
|
240
|
-
return '';
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* 重置滑动状态
|
|
245
|
-
* @param {Object} event
|
|
246
|
-
*/
|
|
247
|
-
function resetTouchStatus(instance) {
|
|
248
|
-
var state = instance.getState();
|
|
249
|
-
state.direction = '';
|
|
250
|
-
state.deltaX = 0;
|
|
251
|
-
state.deltaY = 0;
|
|
252
|
-
state.offsetX = 0;
|
|
253
|
-
state.offsetY = 0;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* 设置滑动开始位置
|
|
258
|
-
* @param {Object} event
|
|
259
|
-
*/
|
|
260
|
-
function stopTouchStart(event) {
|
|
261
|
-
var instance = event.instance;
|
|
262
|
-
var state = instance.getState();
|
|
263
|
-
resetTouchStatus(instance);
|
|
264
|
-
var touch = event.touches[0];
|
|
265
|
-
if (IS_HTML5 && isPC()) {
|
|
266
|
-
touch = event;
|
|
267
|
-
}
|
|
268
|
-
state.startX = touch.clientX;
|
|
269
|
-
state.startY = touch.clientY;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* 滑动中,是否禁止打开
|
|
274
|
-
* @param {Object} event
|
|
275
|
-
*/
|
|
276
|
-
function stopTouchMove(event) {
|
|
277
|
-
var instance = event.instance;
|
|
278
|
-
var state = instance.getState();
|
|
279
|
-
var touch = event.touches[0];
|
|
280
|
-
if (IS_HTML5 && isPC()) {
|
|
281
|
-
touch = event;
|
|
282
|
-
}
|
|
283
|
-
state.deltaX = touch.clientX - state.startX;
|
|
284
|
-
state.deltaY = touch.clientY - state.startY;
|
|
285
|
-
state.offsetY = Math.abs(state.deltaY);
|
|
286
|
-
state.offsetX = Math.abs(state.deltaX);
|
|
287
|
-
state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function isPC() {
|
|
291
|
-
var userAgentInfo = navigator.userAgent;
|
|
292
|
-
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
|
293
|
-
var flag = true;
|
|
294
|
-
for (var v = 0; v < Agents.length - 1; v++) {
|
|
295
|
-
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
|
296
|
-
flag = false;
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return flag;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var movable = false
|
|
304
|
-
|
|
305
|
-
function mousedown(e, ins) {
|
|
306
|
-
if (!IS_HTML5) return
|
|
307
|
-
if (!isPC()) return
|
|
308
|
-
touchstart(e, ins)
|
|
309
|
-
movable = true
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function mousemove(e, ins) {
|
|
313
|
-
if (!IS_HTML5) return
|
|
314
|
-
if (!isPC()) return
|
|
315
|
-
if (!movable) return
|
|
316
|
-
touchmove(e, ins)
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
function mouseup(e, ins) {
|
|
320
|
-
if (!IS_HTML5) return
|
|
321
|
-
if (!isPC()) return
|
|
322
|
-
touchend(e, ins)
|
|
323
|
-
movable = false
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function mouseleave(e, ins) {
|
|
327
|
-
if (!IS_HTML5) return
|
|
328
|
-
if (!isPC()) return
|
|
329
|
-
movable = false
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
module.exports = {
|
|
333
|
-
showWatch: showWatch,
|
|
334
|
-
touchstart: touchstart,
|
|
335
|
-
touchmove: touchmove,
|
|
336
|
-
touchend: touchend,
|
|
337
|
-
mousedown: mousedown,
|
|
338
|
-
mousemove: mousemove,
|
|
339
|
-
mouseup: mouseup,
|
|
340
|
-
mouseleave: mouseleave
|
|
341
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|