@vtj/materials 0.13.15 → 0.13.17
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/assets/antdv/index.umd.js +2 -2
- package/dist/assets/charts/index.umd.js +2 -2
- package/dist/assets/element/index.umd.js +3 -3
- package/dist/assets/icons/index.umd.js +2 -2
- package/dist/assets/ui/index.umd.js +2 -2
- package/dist/assets/uni-h5/index.umd.js +2 -2
- package/dist/assets/uni-ui/index.umd.js +2 -2
- package/dist/assets/vant/index.umd.js +2 -2
- package/dist/deps/@vtj/charts/index.umd.js +2 -2
- package/dist/deps/@vtj/icons/index.umd.js +2 -2
- package/dist/deps/@vtj/ui/index.umd.js +4 -4
- package/dist/deps/@vtj/ui/style.css +1 -1
- package/dist/deps/@vtj/utils/index.umd.js +28 -33
- package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
- package/dist/deps/element-plus/index.css +1 -1
- package/dist/deps/element-plus/index.full.min.js +14 -14
- package/dist/deps/element-plus/zh-cn.js +1 -1
- package/dist/deps/uni-app/index.umd.js +1 -1
- package/dist/deps/uni-h5/index.umd.js +8 -8
- package/dist/deps/uni-h5/style.css +1 -1
- package/dist/deps/uni-h5-vue/index.umd.js +1 -1
- package/dist/deps/uni-ui/index.umd.js +6 -1
- package/dist/deps/uni-ui/style.css +1 -1
- package/dist/deps/vue/vue.global.js +88 -53
- package/dist/deps/vue/vue.global.prod.js +9 -9
- package/package.json +12 -12
- package/src/antdv/image.ts +1 -1
- package/src/element/image.ts +1 -1
- package/src/element/virtualizedTable.ts +6 -6
- package/src/manifest.json +69 -0
- package/src/pages/index.vue +2 -0
- package/src/pages.json +19 -0
- package/src/uni-ui/index.ts +88 -58
- package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
- package/src/version.ts +2 -2
- package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
- package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
- package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
- package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
- package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
- package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
- package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
- package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
- package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
- package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
- package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
- package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
- package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
- package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
- package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
- package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
- package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
- package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
- package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
- package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
- package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
- package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
- package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
- package/src/uni-ui/lib/uni-forms/utils.js +0 -293
- package/src/uni-ui/lib/uni-forms/validate.js +0 -486
- package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
- package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
- package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
- package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
- package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
- package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
- package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
- package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
- package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
- package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
- package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
- package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
- package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
- package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
- package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
- package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
- package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
- package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
- package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
- package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
- package/src/uni-ui/lib/uni-popup/popup.js +0 -26
- package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
- package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
- package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
- package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
- package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
- package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
- package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
- package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
- package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
- package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
- package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
- package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
- package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
- package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
- package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
- package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
- package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
- package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
- package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
- package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
- package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
- package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
- package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
- package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
- package/src/uni-ui/polyfill.ts +0 -41
@@ -1,195 +0,0 @@
|
|
1
|
-
export default {
|
2
|
-
data() {
|
3
|
-
return {
|
4
|
-
x: 0,
|
5
|
-
transition: false,
|
6
|
-
width: 0,
|
7
|
-
viewWidth: 0,
|
8
|
-
swipeShow: 0
|
9
|
-
}
|
10
|
-
},
|
11
|
-
watch: {
|
12
|
-
show(newVal) {
|
13
|
-
if (this.autoClose) return
|
14
|
-
if (newVal && newVal !== 'none') {
|
15
|
-
this.transition = true
|
16
|
-
this.open(newVal)
|
17
|
-
} else {
|
18
|
-
this.close()
|
19
|
-
}
|
20
|
-
}
|
21
|
-
},
|
22
|
-
created() {
|
23
|
-
this.swipeaction = this.getSwipeAction()
|
24
|
-
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
25
|
-
this.swipeaction.children.push(this)
|
26
|
-
}
|
27
|
-
},
|
28
|
-
mounted() {
|
29
|
-
this.isopen = false
|
30
|
-
setTimeout(() => {
|
31
|
-
this.getQuerySelect()
|
32
|
-
}, 50)
|
33
|
-
},
|
34
|
-
methods: {
|
35
|
-
appTouchStart(e) {
|
36
|
-
const {
|
37
|
-
clientX
|
38
|
-
} = e.changedTouches[0]
|
39
|
-
this.clientX = clientX
|
40
|
-
this.timestamp = new Date().getTime()
|
41
|
-
},
|
42
|
-
appTouchEnd(e, index, item, position) {
|
43
|
-
const {
|
44
|
-
clientX
|
45
|
-
} = e.changedTouches[0]
|
46
|
-
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
|
47
|
-
let diff = Math.abs(this.clientX - clientX)
|
48
|
-
let time = (new Date().getTime()) - this.timestamp
|
49
|
-
if (diff < 40 && time < 300) {
|
50
|
-
this.$emit('click', {
|
51
|
-
content: item,
|
52
|
-
index,
|
53
|
-
position
|
54
|
-
})
|
55
|
-
}
|
56
|
-
},
|
57
|
-
/**
|
58
|
-
* 移动触发
|
59
|
-
* @param {Object} e
|
60
|
-
*/
|
61
|
-
onChange(e) {
|
62
|
-
this.moveX = e.detail.x
|
63
|
-
this.isclose = false
|
64
|
-
},
|
65
|
-
touchstart(e) {
|
66
|
-
this.transition = false
|
67
|
-
this.isclose = true
|
68
|
-
if (this.autoClose && this.swipeaction) {
|
69
|
-
this.swipeaction.closeOther(this)
|
70
|
-
}
|
71
|
-
},
|
72
|
-
touchmove(e) {},
|
73
|
-
touchend(e) {
|
74
|
-
// 0的位置什么都不执行
|
75
|
-
if (this.isclose && this.isopen === 'none') return
|
76
|
-
if (this.isclose && this.isopen !== 'none') {
|
77
|
-
this.transition = true
|
78
|
-
this.close()
|
79
|
-
} else {
|
80
|
-
this.move(this.moveX + this.leftWidth)
|
81
|
-
}
|
82
|
-
},
|
83
|
-
|
84
|
-
/**
|
85
|
-
* 移动
|
86
|
-
* @param {Object} moveX
|
87
|
-
*/
|
88
|
-
move(moveX) {
|
89
|
-
// 打开关闭的处理逻辑不太一样
|
90
|
-
this.transition = true
|
91
|
-
// 未打开状态
|
92
|
-
if (!this.isopen || this.isopen === 'none') {
|
93
|
-
if (moveX > this.threshold) {
|
94
|
-
this.open('left')
|
95
|
-
} else if (moveX < -this.threshold) {
|
96
|
-
this.open('right')
|
97
|
-
} else {
|
98
|
-
this.close()
|
99
|
-
}
|
100
|
-
} else {
|
101
|
-
if (moveX < 0 && moveX < this.rightWidth) {
|
102
|
-
const rightX = this.rightWidth + moveX
|
103
|
-
if (rightX < this.threshold) {
|
104
|
-
this.open('right')
|
105
|
-
} else {
|
106
|
-
this.close()
|
107
|
-
}
|
108
|
-
} else if (moveX > 0 && moveX < this.leftWidth) {
|
109
|
-
const leftX = this.leftWidth - moveX
|
110
|
-
if (leftX < this.threshold) {
|
111
|
-
this.open('left')
|
112
|
-
} else {
|
113
|
-
this.close()
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
},
|
120
|
-
|
121
|
-
/**
|
122
|
-
* 打开
|
123
|
-
*/
|
124
|
-
open(type) {
|
125
|
-
this.x = this.moveX
|
126
|
-
this.animation(type)
|
127
|
-
},
|
128
|
-
|
129
|
-
/**
|
130
|
-
* 关闭
|
131
|
-
*/
|
132
|
-
close() {
|
133
|
-
this.x = this.moveX
|
134
|
-
// TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化
|
135
|
-
this.$nextTick(() => {
|
136
|
-
this.x = -this.leftWidth
|
137
|
-
if (this.isopen !== 'none') {
|
138
|
-
this.$emit('change', 'none')
|
139
|
-
}
|
140
|
-
this.isopen = 'none'
|
141
|
-
})
|
142
|
-
},
|
143
|
-
|
144
|
-
/**
|
145
|
-
* 执行结束动画
|
146
|
-
* @param {Object} type
|
147
|
-
*/
|
148
|
-
animation(type) {
|
149
|
-
this.$nextTick(() => {
|
150
|
-
if (type === 'left') {
|
151
|
-
this.x = 0
|
152
|
-
} else {
|
153
|
-
this.x = -this.rightWidth - this.leftWidth
|
154
|
-
}
|
155
|
-
|
156
|
-
if (this.isopen !== type) {
|
157
|
-
this.$emit('change', type)
|
158
|
-
}
|
159
|
-
this.isopen = type
|
160
|
-
})
|
161
|
-
|
162
|
-
},
|
163
|
-
getSlide(x) {},
|
164
|
-
getQuerySelect() {
|
165
|
-
const query = uni.createSelectorQuery().in(this);
|
166
|
-
query.selectAll('.movable-view--hock').boundingClientRect(data => {
|
167
|
-
this.leftWidth = data[1].width
|
168
|
-
this.rightWidth = data[2].width
|
169
|
-
this.width = data[0].width
|
170
|
-
this.viewWidth = this.width + this.rightWidth + this.leftWidth
|
171
|
-
if (this.leftWidth === 0) {
|
172
|
-
// TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点
|
173
|
-
this.x = -0.1
|
174
|
-
} else {
|
175
|
-
this.x = -this.leftWidth
|
176
|
-
}
|
177
|
-
this.moveX = this.x
|
178
|
-
this.$nextTick(() => {
|
179
|
-
this.swipeShow = 1
|
180
|
-
})
|
181
|
-
|
182
|
-
if (!this.buttonWidth) {
|
183
|
-
this.disabledView = true
|
184
|
-
}
|
185
|
-
|
186
|
-
if (this.autoClose) return
|
187
|
-
if (this.show !== 'none') {
|
188
|
-
this.transition = true
|
189
|
-
this.open(this.shows)
|
190
|
-
}
|
191
|
-
}).exec();
|
192
|
-
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
@@ -1,260 +0,0 @@
|
|
1
|
-
let otherMixins = {}
|
2
|
-
|
3
|
-
// #ifndef APP-PLUS|| MP-WEIXIN || H5
|
4
|
-
const MIN_DISTANCE = 10;
|
5
|
-
otherMixins = {
|
6
|
-
data() {
|
7
|
-
// TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
|
8
|
-
const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
|
9
|
-
return {
|
10
|
-
uniShow: false,
|
11
|
-
left: 0,
|
12
|
-
buttonShow: 'none',
|
13
|
-
ani: false,
|
14
|
-
moveLeft: '',
|
15
|
-
elClass
|
16
|
-
}
|
17
|
-
},
|
18
|
-
watch: {
|
19
|
-
show(newVal) {
|
20
|
-
if (this.autoClose) return
|
21
|
-
this.openState(newVal)
|
22
|
-
},
|
23
|
-
left() {
|
24
|
-
this.moveLeft = `translateX(${this.left}px)`
|
25
|
-
},
|
26
|
-
buttonShow(newVal) {
|
27
|
-
if (this.autoClose) return
|
28
|
-
this.openState(newVal)
|
29
|
-
},
|
30
|
-
leftOptions() {
|
31
|
-
this.init()
|
32
|
-
},
|
33
|
-
rightOptions() {
|
34
|
-
this.init()
|
35
|
-
}
|
36
|
-
},
|
37
|
-
mounted() {
|
38
|
-
this.swipeaction = this.getSwipeAction()
|
39
|
-
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
40
|
-
this.swipeaction.children.push(this)
|
41
|
-
}
|
42
|
-
this.init()
|
43
|
-
},
|
44
|
-
methods: {
|
45
|
-
init() {
|
46
|
-
clearTimeout(this.timer)
|
47
|
-
this.timer = setTimeout(() => {
|
48
|
-
this.getSelectorQuery()
|
49
|
-
}, 100)
|
50
|
-
// 移动距离
|
51
|
-
this.left = 0
|
52
|
-
this.x = 0
|
53
|
-
},
|
54
|
-
|
55
|
-
closeSwipe(e) {
|
56
|
-
if (this.autoClose && this.swipeaction) {
|
57
|
-
this.swipeaction.closeOther(this)
|
58
|
-
}
|
59
|
-
},
|
60
|
-
appTouchStart(e) {
|
61
|
-
const {
|
62
|
-
clientX
|
63
|
-
} = e.changedTouches[0]
|
64
|
-
this.clientX = clientX
|
65
|
-
this.timestamp = new Date().getTime()
|
66
|
-
},
|
67
|
-
appTouchEnd(e, index, item, position) {
|
68
|
-
const {
|
69
|
-
clientX
|
70
|
-
} = e.changedTouches[0]
|
71
|
-
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
|
72
|
-
let diff = Math.abs(this.clientX - clientX)
|
73
|
-
let time = (new Date().getTime()) - this.timestamp
|
74
|
-
if (diff < 40 && time < 300) {
|
75
|
-
this.$emit('click', {
|
76
|
-
content: item,
|
77
|
-
index,
|
78
|
-
position
|
79
|
-
})
|
80
|
-
}
|
81
|
-
},
|
82
|
-
touchstart(e) {
|
83
|
-
if (this.disabled) return
|
84
|
-
this.ani = false
|
85
|
-
this.x = this.left || 0
|
86
|
-
this.stopTouchStart(e)
|
87
|
-
this.autoClose && this.closeSwipe()
|
88
|
-
},
|
89
|
-
touchmove(e) {
|
90
|
-
if (this.disabled) return
|
91
|
-
// 是否可以滑动页面
|
92
|
-
this.stopTouchMove(e);
|
93
|
-
if (this.direction !== 'horizontal') {
|
94
|
-
return;
|
95
|
-
}
|
96
|
-
this.move(this.x + this.deltaX)
|
97
|
-
return false
|
98
|
-
},
|
99
|
-
touchend() {
|
100
|
-
if (this.disabled) return
|
101
|
-
this.moveDirection(this.left)
|
102
|
-
},
|
103
|
-
/**
|
104
|
-
* 设置移动距离
|
105
|
-
* @param {Object} value
|
106
|
-
*/
|
107
|
-
move(value) {
|
108
|
-
value = value || 0
|
109
|
-
const leftWidth = this.leftWidth
|
110
|
-
const rightWidth = this.rightWidth
|
111
|
-
// 获取可滑动范围
|
112
|
-
this.left = this.range(value, -rightWidth, leftWidth);
|
113
|
-
},
|
114
|
-
|
115
|
-
/**
|
116
|
-
* 获取范围
|
117
|
-
* @param {Object} num
|
118
|
-
* @param {Object} min
|
119
|
-
* @param {Object} max
|
120
|
-
*/
|
121
|
-
range(num, min, max) {
|
122
|
-
return Math.min(Math.max(num, min), max);
|
123
|
-
},
|
124
|
-
/**
|
125
|
-
* 移动方向判断
|
126
|
-
* @param {Object} left
|
127
|
-
* @param {Object} value
|
128
|
-
*/
|
129
|
-
moveDirection(left) {
|
130
|
-
const threshold = this.threshold
|
131
|
-
const isopen = this.isopen || 'none'
|
132
|
-
const leftWidth = this.leftWidth
|
133
|
-
const rightWidth = this.rightWidth
|
134
|
-
if (this.deltaX === 0) {
|
135
|
-
this.openState('none')
|
136
|
-
return
|
137
|
-
}
|
138
|
-
if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth >
|
139
|
-
0 && rightWidth +
|
140
|
-
left < threshold)) {
|
141
|
-
// right
|
142
|
-
this.openState('right')
|
143
|
-
} else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth >
|
144
|
-
0 &&
|
145
|
-
leftWidth - left < threshold)) {
|
146
|
-
// left
|
147
|
-
this.openState('left')
|
148
|
-
} else {
|
149
|
-
// default
|
150
|
-
this.openState('none')
|
151
|
-
}
|
152
|
-
},
|
153
|
-
|
154
|
-
/**
|
155
|
-
* 开启状态
|
156
|
-
* @param {Boolean} type
|
157
|
-
*/
|
158
|
-
openState(type) {
|
159
|
-
const leftWidth = this.leftWidth
|
160
|
-
const rightWidth = this.rightWidth
|
161
|
-
let left = ''
|
162
|
-
this.isopen = this.isopen ? this.isopen : 'none'
|
163
|
-
switch (type) {
|
164
|
-
case "left":
|
165
|
-
left = leftWidth
|
166
|
-
break
|
167
|
-
case "right":
|
168
|
-
left = -rightWidth
|
169
|
-
break
|
170
|
-
default:
|
171
|
-
left = 0
|
172
|
-
}
|
173
|
-
|
174
|
-
|
175
|
-
if (this.isopen !== type) {
|
176
|
-
this.throttle = true
|
177
|
-
this.$emit('change', type)
|
178
|
-
}
|
179
|
-
|
180
|
-
this.isopen = type
|
181
|
-
// 添加动画类
|
182
|
-
this.ani = true
|
183
|
-
this.$nextTick(() => {
|
184
|
-
this.move(left)
|
185
|
-
})
|
186
|
-
// 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
|
187
|
-
},
|
188
|
-
close() {
|
189
|
-
this.openState('none')
|
190
|
-
},
|
191
|
-
getDirection(x, y) {
|
192
|
-
if (x > y && x > MIN_DISTANCE) {
|
193
|
-
return 'horizontal';
|
194
|
-
}
|
195
|
-
if (y > x && y > MIN_DISTANCE) {
|
196
|
-
return 'vertical';
|
197
|
-
}
|
198
|
-
return '';
|
199
|
-
},
|
200
|
-
|
201
|
-
/**
|
202
|
-
* 重置滑动状态
|
203
|
-
* @param {Object} event
|
204
|
-
*/
|
205
|
-
resetTouchStatus() {
|
206
|
-
this.direction = '';
|
207
|
-
this.deltaX = 0;
|
208
|
-
this.deltaY = 0;
|
209
|
-
this.offsetX = 0;
|
210
|
-
this.offsetY = 0;
|
211
|
-
},
|
212
|
-
|
213
|
-
/**
|
214
|
-
* 设置滑动开始位置
|
215
|
-
* @param {Object} event
|
216
|
-
*/
|
217
|
-
stopTouchStart(event) {
|
218
|
-
this.resetTouchStatus();
|
219
|
-
const touch = event.touches[0];
|
220
|
-
this.startX = touch.clientX;
|
221
|
-
this.startY = touch.clientY;
|
222
|
-
},
|
223
|
-
|
224
|
-
/**
|
225
|
-
* 滑动中,是否禁止打开
|
226
|
-
* @param {Object} event
|
227
|
-
*/
|
228
|
-
stopTouchMove(event) {
|
229
|
-
const touch = event.touches[0];
|
230
|
-
this.deltaX = touch.clientX - this.startX;
|
231
|
-
this.deltaY = touch.clientY - this.startY;
|
232
|
-
this.offsetX = Math.abs(this.deltaX);
|
233
|
-
this.offsetY = Math.abs(this.deltaY);
|
234
|
-
this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY);
|
235
|
-
},
|
236
|
-
|
237
|
-
getSelectorQuery() {
|
238
|
-
const views = uni.createSelectorQuery().in(this)
|
239
|
-
views
|
240
|
-
.selectAll('.' + this.elClass)
|
241
|
-
.boundingClientRect(data => {
|
242
|
-
if (data.length === 0) return
|
243
|
-
let show = 'none'
|
244
|
-
if (this.autoClose) {
|
245
|
-
show = 'none'
|
246
|
-
} else {
|
247
|
-
show = this.show
|
248
|
-
}
|
249
|
-
this.leftWidth = data[0].width || 0
|
250
|
-
this.rightWidth = data[1].width || 0
|
251
|
-
this.buttonShow = show
|
252
|
-
})
|
253
|
-
.exec()
|
254
|
-
}
|
255
|
-
}
|
256
|
-
}
|
257
|
-
|
258
|
-
// #endif
|
259
|
-
|
260
|
-
export default otherMixins
|
@@ -1,84 +0,0 @@
|
|
1
|
-
let mpMixins = {}
|
2
|
-
let is_pc = null
|
3
|
-
// #ifdef H5
|
4
|
-
import {
|
5
|
-
isPC
|
6
|
-
} from "./isPC"
|
7
|
-
is_pc = isPC()
|
8
|
-
// #endif
|
9
|
-
// #ifdef APP-VUE|| MP-WEIXIN || H5
|
10
|
-
|
11
|
-
mpMixins = {
|
12
|
-
data() {
|
13
|
-
return {
|
14
|
-
is_show: 'none'
|
15
|
-
}
|
16
|
-
},
|
17
|
-
watch: {
|
18
|
-
show(newVal) {
|
19
|
-
this.is_show = this.show
|
20
|
-
}
|
21
|
-
},
|
22
|
-
created() {
|
23
|
-
this.swipeaction = this.getSwipeAction()
|
24
|
-
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
25
|
-
this.swipeaction.children.push(this)
|
26
|
-
}
|
27
|
-
},
|
28
|
-
mounted() {
|
29
|
-
this.is_show = this.show
|
30
|
-
},
|
31
|
-
methods: {
|
32
|
-
// wxs 中调用
|
33
|
-
closeSwipe(e) {
|
34
|
-
if (this.autoClose && this.swipeaction) {
|
35
|
-
this.swipeaction.closeOther(this)
|
36
|
-
}
|
37
|
-
},
|
38
|
-
|
39
|
-
change(e) {
|
40
|
-
this.$emit('change', e.open)
|
41
|
-
if (this.is_show !== e.open) {
|
42
|
-
this.is_show = e.open
|
43
|
-
}
|
44
|
-
},
|
45
|
-
|
46
|
-
appTouchStart(e) {
|
47
|
-
if (is_pc) return
|
48
|
-
const {
|
49
|
-
clientX
|
50
|
-
} = e.changedTouches[0]
|
51
|
-
this.clientX = clientX
|
52
|
-
this.timestamp = new Date().getTime()
|
53
|
-
},
|
54
|
-
appTouchEnd(e, index, item, position) {
|
55
|
-
if (is_pc) return
|
56
|
-
const {
|
57
|
-
clientX
|
58
|
-
} = e.changedTouches[0]
|
59
|
-
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
|
60
|
-
let diff = Math.abs(this.clientX - clientX)
|
61
|
-
let time = (new Date().getTime()) - this.timestamp
|
62
|
-
if (diff < 40 && time < 300) {
|
63
|
-
this.$emit('click', {
|
64
|
-
content: item,
|
65
|
-
index,
|
66
|
-
position
|
67
|
-
})
|
68
|
-
}
|
69
|
-
},
|
70
|
-
onClickForPC(index, item, position) {
|
71
|
-
if (!is_pc) return
|
72
|
-
// #ifdef H5
|
73
|
-
this.$emit('click', {
|
74
|
-
content: item,
|
75
|
-
index,
|
76
|
-
position
|
77
|
-
})
|
78
|
-
// #endif
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
// #endif
|
84
|
-
export default mpMixins
|