@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.
Files changed (127) hide show
  1. package/dist/assets/antdv/index.umd.js +2 -2
  2. package/dist/assets/charts/index.umd.js +2 -2
  3. package/dist/assets/element/index.umd.js +3 -3
  4. package/dist/assets/icons/index.umd.js +2 -2
  5. package/dist/assets/ui/index.umd.js +2 -2
  6. package/dist/assets/uni-h5/index.umd.js +2 -2
  7. package/dist/assets/uni-ui/index.umd.js +2 -2
  8. package/dist/assets/vant/index.umd.js +2 -2
  9. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  10. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  11. package/dist/deps/@vtj/ui/index.umd.js +4 -4
  12. package/dist/deps/@vtj/ui/style.css +1 -1
  13. package/dist/deps/@vtj/utils/index.umd.js +28 -33
  14. package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
  15. package/dist/deps/element-plus/index.css +1 -1
  16. package/dist/deps/element-plus/index.full.min.js +14 -14
  17. package/dist/deps/element-plus/zh-cn.js +1 -1
  18. package/dist/deps/uni-app/index.umd.js +1 -1
  19. package/dist/deps/uni-h5/index.umd.js +8 -8
  20. package/dist/deps/uni-h5/style.css +1 -1
  21. package/dist/deps/uni-h5-vue/index.umd.js +1 -1
  22. package/dist/deps/uni-ui/index.umd.js +6 -1
  23. package/dist/deps/uni-ui/style.css +1 -1
  24. package/dist/deps/vue/vue.global.js +88 -53
  25. package/dist/deps/vue/vue.global.prod.js +9 -9
  26. package/package.json +12 -12
  27. package/src/antdv/image.ts +1 -1
  28. package/src/element/image.ts +1 -1
  29. package/src/element/virtualizedTable.ts +6 -6
  30. package/src/manifest.json +69 -0
  31. package/src/pages/index.vue +2 -0
  32. package/src/pages.json +19 -0
  33. package/src/uni-ui/index.ts +88 -58
  34. package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
  35. package/src/version.ts +2 -2
  36. package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
  37. package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
  38. package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
  39. package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
  40. package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
  41. package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
  42. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
  43. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
  44. package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
  45. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
  46. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
  47. package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
  48. package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
  49. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
  50. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
  51. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
  52. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
  53. package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
  54. package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
  55. package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
  56. package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
  57. package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
  58. package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
  59. package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
  60. package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
  61. package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
  62. package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
  63. package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
  64. package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
  65. package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
  66. package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
  67. package/src/uni-ui/lib/uni-forms/utils.js +0 -293
  68. package/src/uni-ui/lib/uni-forms/validate.js +0 -486
  69. package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
  70. package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
  71. package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
  72. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
  73. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
  74. package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
  75. package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
  76. package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
  77. package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
  78. package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
  79. package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  80. package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
  81. package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
  82. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
  83. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
  84. package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
  85. package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
  86. package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
  87. package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
  88. package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
  89. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
  90. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
  91. package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
  92. package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
  93. package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
  94. package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
  95. package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
  96. package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
  97. package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
  98. package/src/uni-ui/lib/uni-popup/popup.js +0 -26
  99. package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
  100. package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
  101. package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
  102. package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
  103. package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
  104. package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
  105. package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
  106. package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
  107. package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
  108. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
  109. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
  110. package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
  111. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
  112. package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
  113. package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
  114. package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
  115. package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
  116. package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
  117. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
  118. package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
  119. package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
  120. package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
  121. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
  122. package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
  123. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
  124. package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
  125. package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
  126. package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
  127. package/src/uni-ui/polyfill.ts +0 -41
@@ -1,339 +0,0 @@
1
- <template>
2
- <view class="uni-searchbar">
3
- <view
4
- :style="{ borderRadius: radius + 'px', backgroundColor: bgColor }"
5
- class="uni-searchbar__box"
6
- @click="searchClick">
7
- <view class="uni-searchbar__box-icon-search">
8
- <slot name="searchIcon">
9
- <uni-icons color="#c0c4cc" size="18" type="search" />
10
- </slot>
11
- </view>
12
- <input
13
- v-if="show || searchVal"
14
- :focus="showSync"
15
- :disabled="readonly"
16
- :placeholder="placeholderText"
17
- :maxlength="maxlength"
18
- class="uni-searchbar__box-search-input"
19
- confirm-type="search"
20
- type="text"
21
- v-model="searchVal"
22
- :style="{ color: textColor }"
23
- @confirm="confirm"
24
- @blur="blur"
25
- @focus="emitFocus" />
26
- <text v-else class="uni-searchbar__text-placeholder">{{
27
- placeholder
28
- }}</text>
29
- <view
30
- v-if="
31
- show &&
32
- (clearButton === 'always' ||
33
- (clearButton === 'auto' && searchVal !== '')) &&
34
- !readonly
35
- "
36
- class="uni-searchbar__box-icon-clear"
37
- @click="clear">
38
- <slot name="clearIcon">
39
- <uni-icons color="#c0c4cc" size="20" type="clear" />
40
- </slot>
41
- </view>
42
- </view>
43
- <text
44
- @click="cancel"
45
- class="uni-searchbar__cancel"
46
- v-if="cancelButton === 'always' || (show && cancelButton === 'auto')"
47
- >{{ cancelTextI18n }}</text
48
- >
49
- </view>
50
- </template>
51
-
52
- <script>
53
- import { initVueI18n } from '@dcloudio/uni-i18n';
54
- import messages from './i18n/index.js';
55
- const { t } = initVueI18n(messages);
56
-
57
- /**
58
- * SearchBar 搜索栏
59
- * @description 搜索栏组件,通常用于搜索商品、文章等
60
- * @tutorial https://ext.dcloud.net.cn/plugin?id=866
61
- * @property {Number} radius 搜索栏圆角
62
- * @property {Number} maxlength 输入最大长度
63
- * @property {String} placeholder 搜索栏Placeholder
64
- * @property {String} clearButton = [always|auto|none] 是否显示清除按钮
65
- * @value always 一直显示
66
- * @value auto 输入框不为空时显示
67
- * @value none 一直不显示
68
- * @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
69
- * @value always 一直显示
70
- * @value auto 输入框不为空时显示
71
- * @value none 一直不显示
72
- * @property {String} cancelText 取消按钮的文字
73
- * @property {String} bgColor 输入框背景颜色
74
- * @property {String} textColor 输入文字颜色
75
- * @property {Boolean} focus 是否自动聚焦
76
- * @property {Boolean} readonly 组件只读,不能有任何操作,只做展示
77
- * @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
78
- * @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
79
- * @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
80
- * @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
81
- * @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
82
- */
83
-
84
- export default {
85
- name: 'UniSearchBar',
86
- emits: [
87
- 'input',
88
- 'update:modelValue',
89
- 'clear',
90
- 'cancel',
91
- 'confirm',
92
- 'blur',
93
- 'focus'
94
- ],
95
- props: {
96
- placeholder: {
97
- type: String,
98
- default: ''
99
- },
100
- radius: {
101
- type: [Number, String],
102
- default: 5
103
- },
104
- clearButton: {
105
- type: String,
106
- default: 'auto'
107
- },
108
- cancelButton: {
109
- type: String,
110
- default: 'auto'
111
- },
112
- cancelText: {
113
- type: String,
114
- default: ''
115
- },
116
- bgColor: {
117
- type: String,
118
- default: '#F8F8F8'
119
- },
120
- textColor: {
121
- type: String,
122
- default: '#000000'
123
- },
124
- maxlength: {
125
- type: [Number, String],
126
- default: 100
127
- },
128
- value: {
129
- type: [Number, String],
130
- default: ''
131
- },
132
- modelValue: {
133
- type: [Number, String],
134
- default: ''
135
- },
136
- focus: {
137
- type: Boolean,
138
- default: false
139
- },
140
- readonly: {
141
- type: Boolean,
142
- default: false
143
- }
144
- },
145
- data() {
146
- return {
147
- show: false,
148
- showSync: false,
149
- searchVal: ''
150
- };
151
- },
152
- computed: {
153
- cancelTextI18n() {
154
- return this.cancelText || t('uni-search-bar.cancel');
155
- },
156
- placeholderText() {
157
- return this.placeholder || t('uni-search-bar.placeholder');
158
- }
159
- },
160
- watch: {
161
- // #ifndef VUE3
162
- // value: {
163
- // immediate: true,
164
- // handler(newVal) {
165
- // this.searchVal = newVal;
166
- // if (newVal) {
167
- // this.show = true;
168
- // }
169
- // }
170
- // },
171
- // #endif
172
- // #ifdef VUE3
173
- modelValue: {
174
- immediate: true,
175
- handler(newVal) {
176
- this.searchVal = newVal;
177
- if (newVal) {
178
- this.show = true;
179
- }
180
- }
181
- },
182
- // #endif
183
- focus: {
184
- immediate: true,
185
- handler(newVal) {
186
- if (newVal) {
187
- if (this.readonly) return;
188
- this.show = true;
189
- this.$nextTick(() => {
190
- this.showSync = true;
191
- });
192
- }
193
- }
194
- },
195
- searchVal(newVal, oldVal) {
196
- this.$emit('input', newVal);
197
- // #ifdef VUE3
198
- this.$emit('update:modelValue', newVal);
199
- // #endif
200
- }
201
- },
202
- methods: {
203
- searchClick() {
204
- if (this.readonly) return;
205
- if (this.show) {
206
- return;
207
- }
208
- this.show = true;
209
- this.$nextTick(() => {
210
- this.showSync = true;
211
- });
212
- },
213
- clear() {
214
- this.searchVal = '';
215
- this.$nextTick(() => {
216
- this.$emit('clear', { value: '' });
217
- });
218
- },
219
- cancel() {
220
- if (this.readonly) return;
221
- this.$emit('cancel', {
222
- value: this.searchVal
223
- });
224
- this.searchVal = '';
225
- this.show = false;
226
- this.showSync = false;
227
- // #ifndef APP-PLUS
228
- uni.hideKeyboard();
229
- // #endif
230
- // #ifdef APP-PLUS
231
- // plus.key.hideSoftKeybord();
232
- // #endif
233
- },
234
- confirm() {
235
- // #ifndef APP-PLUS
236
- uni.hideKeyboard();
237
- // #endif
238
- // #ifdef APP-PLUS
239
- // plus.key.hideSoftKeybord();
240
- // #endif
241
- this.$emit('confirm', {
242
- value: this.searchVal
243
- });
244
- },
245
- blur() {
246
- // #ifndef APP-PLUS
247
- uni.hideKeyboard();
248
- // #endif
249
- // #ifdef APP-PLUS
250
- // plus.key.hideSoftKeybord();
251
- // #endif
252
- this.$emit('blur', {
253
- value: this.searchVal
254
- });
255
- },
256
- emitFocus(e) {
257
- this.$emit('focus', e.detail);
258
- }
259
- }
260
- };
261
- </script>
262
-
263
- <style lang="scss">
264
- $uni-searchbar-height: 36px;
265
-
266
- .uni-searchbar {
267
- /* #ifndef APP-NVUE */
268
- display: flex;
269
- /* #endif */
270
- flex-direction: row;
271
- position: relative;
272
- padding: 10px;
273
- // background-color: #fff;
274
- }
275
-
276
- .uni-searchbar__box {
277
- /* #ifndef APP-NVUE */
278
- display: flex;
279
- box-sizing: border-box;
280
- justify-content: left;
281
- /* #endif */
282
- overflow: hidden;
283
- position: relative;
284
- flex: 1;
285
- flex-direction: row;
286
- align-items: center;
287
- height: $uni-searchbar-height;
288
- padding: 5px 8px 5px 0px;
289
- }
290
-
291
- .uni-searchbar__box-icon-search {
292
- /* #ifndef APP-NVUE */
293
- display: flex;
294
- /* #endif */
295
- flex-direction: row;
296
- // width: 32px;
297
- padding: 0 8px;
298
- justify-content: center;
299
- align-items: center;
300
- color: #b3b3b3;
301
- }
302
-
303
- .uni-searchbar__box-search-input {
304
- flex: 1;
305
- font-size: 14px;
306
- color: #333;
307
- margin-left: 5px;
308
- margin-top: 1px;
309
- /* #ifndef APP-NVUE */
310
- background-color: inherit;
311
- /* #endif */
312
- }
313
-
314
- .uni-searchbar__box-icon-clear {
315
- align-items: center;
316
- line-height: 24px;
317
- padding-left: 8px;
318
- /* #ifdef H5 */
319
- cursor: pointer;
320
- /* #endif */
321
- }
322
-
323
- .uni-searchbar__text-placeholder {
324
- font-size: 14px;
325
- color: #b3b3b3;
326
- margin-left: 5px;
327
- text-align: left;
328
- }
329
-
330
- .uni-searchbar__cancel {
331
- padding-left: 10px;
332
- line-height: $uni-searchbar-height;
333
- font-size: 14px;
334
- color: #333333;
335
- /* #ifdef H5 */
336
- cursor: pointer;
337
- /* #endif */
338
- }
339
- </style>
@@ -1,311 +0,0 @@
1
- let bindIngXMixins = {};
2
-
3
- // #ifdef APP-NVUE
4
- // const BindingX = uni.requireNativePlugin('bindingx');
5
- // const dom = uni.requireNativePlugin('dom');
6
- // const animation = uni.requireNativePlugin('animation');
7
-
8
- bindIngXMixins = {
9
- data() {
10
- return {};
11
- },
12
-
13
- watch: {
14
- show(newVal) {
15
- if (this.autoClose) return;
16
- if (this.stop) return;
17
- this.stop = true;
18
- if (newVal) {
19
- this.open(newVal);
20
- } else {
21
- this.close();
22
- }
23
- },
24
- leftOptions() {
25
- this.getSelectorQuery();
26
- this.init();
27
- },
28
- rightOptions(newVal) {
29
- this.init();
30
- }
31
- },
32
- created() {
33
- this.swipeaction = this.getSwipeAction();
34
- if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
35
- this.swipeaction.children.push(this);
36
- }
37
- },
38
- mounted() {
39
- console.log('this', this);
40
- // this.box = this.getEl(this.$refs['selector-box--hock']);
41
- // this.selector = this.getEl(this.$refs['selector-content--hock']);
42
- // this.leftButton = this.getEl(this.$refs['selector-left-button--hock']);
43
- // this.rightButton = this.getEl(this.$refs['selector-right-button--hock']);
44
- this.init();
45
- },
46
- beforeDestroy() {
47
- this.swipeaction.children.forEach((item, index) => {
48
- if (item === this) {
49
- this.swipeaction.children.splice(index, 1);
50
- }
51
- });
52
- },
53
- methods: {
54
- init() {
55
- this.$nextTick(() => {
56
- this.x = 0;
57
- this.button = {
58
- show: false
59
- };
60
- setTimeout(() => {
61
- this.getSelectorQuery();
62
- }, 200);
63
- });
64
- },
65
- onClick(index, item, position) {
66
- this.$emit('click', {
67
- content: item,
68
- index,
69
- position
70
- });
71
- },
72
- touchstart(e) {
73
- // fix by mehaotian 禁止滑动
74
- if (this.disabled) return;
75
- // 每次只触发一次,避免多次监听造成闪烁
76
- if (this.stop) return;
77
- this.stop = true;
78
- if (this.autoClose && this.swipeaction) {
79
- this.swipeaction.closeOther(this);
80
- }
81
-
82
- const leftWidth = this.button.left.width;
83
- const rightWidth = this.button.right.width;
84
- let expression = this.range(this.x, -rightWidth, leftWidth);
85
- let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0);
86
- let rightExpression = this.range(this.x + rightWidth, 0, rightWidth);
87
-
88
- this.eventpan = BindingX.bind(
89
- {
90
- anchor: this.box,
91
- eventType: 'pan',
92
- props: [
93
- {
94
- element: this.selector,
95
- property: 'transform.translateX',
96
- expression
97
- },
98
- {
99
- element: this.leftButton,
100
- property: 'transform.translateX',
101
- expression: leftExpression
102
- },
103
- {
104
- element: this.rightButton,
105
- property: 'transform.translateX',
106
- expression: rightExpression
107
- }
108
- ]
109
- },
110
- (e) => {
111
- // nope
112
- if (e.state === 'end') {
113
- this.x = e.deltaX + this.x;
114
- this.isclick = true;
115
- this.bindTiming(e.deltaX);
116
- }
117
- }
118
- );
119
- },
120
- touchend(e) {
121
- if (this.isopen !== 'none' && !this.isclick) {
122
- this.open('none');
123
- }
124
- },
125
- bindTiming(x) {
126
- const left = this.x;
127
- const leftWidth = this.button.left.width;
128
- const rightWidth = this.button.right.width;
129
- const threshold = this.threshold;
130
- if (!this.isopen || this.isopen === 'none') {
131
- if (left > threshold) {
132
- this.open('left');
133
- } else if (left < -threshold) {
134
- this.open('right');
135
- } else {
136
- this.open('none');
137
- }
138
- } else {
139
- if ((x > -leftWidth && x < 0) || x > rightWidth) {
140
- if ((x > -threshold && x < 0) || x - rightWidth > threshold) {
141
- this.open('left');
142
- } else {
143
- this.open('none');
144
- }
145
- } else {
146
- if ((x < threshold && x > 0) || x + leftWidth < -threshold) {
147
- this.open('right');
148
- } else {
149
- this.open('none');
150
- }
151
- }
152
- }
153
- },
154
-
155
- /**
156
- * 移动范围
157
- * @param {Object} num
158
- * @param {Object} mix
159
- * @param {Object} max
160
- */
161
- range(num, mix, max) {
162
- return `min(max(x+${num}, ${mix}), ${max})`;
163
- },
164
-
165
- /**
166
- * 开启swipe
167
- */
168
- open(type) {
169
- this.animation(type);
170
- },
171
-
172
- /**
173
- * 关闭swipe
174
- */
175
- close() {
176
- this.animation('none');
177
- },
178
-
179
- /**
180
- * 开启关闭动画
181
- * @param {Object} type
182
- */
183
- animation(type) {
184
- const time = 300;
185
- const leftWidth = this.button.left.width;
186
- const rightWidth = this.button.right.width;
187
- if (this.eventpan && this.eventpan.token) {
188
- BindingX.unbind({
189
- token: this.eventpan.token,
190
- eventType: 'pan'
191
- });
192
- }
193
-
194
- switch (type) {
195
- case 'left':
196
- Promise.all([
197
- this.move(this.selector, leftWidth),
198
- this.move(this.leftButton, 0),
199
- this.move(this.rightButton, rightWidth * 2)
200
- ]).then(() => {
201
- this.setEmit(leftWidth, type);
202
- });
203
- break;
204
- case 'right':
205
- Promise.all([
206
- this.move(this.selector, -rightWidth),
207
- this.move(this.leftButton, -leftWidth * 2),
208
- this.move(this.rightButton, 0)
209
- ]).then(() => {
210
- this.setEmit(-rightWidth, type);
211
- });
212
- break;
213
- default:
214
- Promise.all([
215
- this.move(this.selector, 0),
216
- this.move(this.leftButton, -leftWidth),
217
- this.move(this.rightButton, rightWidth)
218
- ]).then(() => {
219
- this.setEmit(0, type);
220
- });
221
- }
222
- },
223
- setEmit(x, type) {
224
- const leftWidth = this.button.left.width;
225
- const rightWidth = this.button.right.width;
226
- this.isopen = this.isopen || 'none';
227
- this.stop = false;
228
- this.isclick = false;
229
- // 只有状态不一致才会返回结果
230
- if (this.isopen !== type && this.x !== x) {
231
- if (type === 'left' && leftWidth > 0) {
232
- this.$emit('change', 'left');
233
- }
234
- if (type === 'right' && rightWidth > 0) {
235
- this.$emit('change', 'right');
236
- }
237
- if (type === 'none') {
238
- this.$emit('change', 'none');
239
- }
240
- }
241
- this.x = x;
242
- this.isopen = type;
243
- },
244
- move(ref, value) {
245
- return new Promise((resolve, reject) => {
246
- animation.transition(
247
- ref,
248
- {
249
- styles: {
250
- transform: `translateX(${value})`
251
- },
252
- duration: 150, //ms
253
- timingFunction: 'linear',
254
- needLayout: false,
255
- delay: 0 //ms
256
- },
257
- function (res) {
258
- resolve(res);
259
- }
260
- );
261
- });
262
- },
263
-
264
- /**
265
- * 获取ref
266
- * @param {Object} el
267
- */
268
- // getEl(el) {
269
- // console.log('getEl', el);
270
- // return el.ref;
271
- // },
272
- /**
273
- * 获取节点信息
274
- */
275
- getSelectorQuery() {
276
- Promise.all([this.getDom('left'), this.getDom('right')]).then((data) => {
277
- let show = 'none';
278
- if (this.autoClose) {
279
- show = 'none';
280
- } else {
281
- show = this.show;
282
- }
283
-
284
- if (show === 'none') {
285
- // this.close()
286
- } else {
287
- this.open(show);
288
- }
289
- });
290
- },
291
- getDom(str) {
292
- return new Promise((resolve, reject) => {
293
- dom.getComponentRect(
294
- this.$refs[`selector-${str}-button--hock`],
295
- (data) => {
296
- if (data) {
297
- this.button[str] = data.size;
298
- resolve(data);
299
- } else {
300
- reject();
301
- }
302
- }
303
- );
304
- });
305
- }
306
- }
307
- };
308
-
309
- // #endif
310
-
311
- export default bindIngXMixins;
@@ -1,12 +0,0 @@
1
- export function isPC() {
2
- var userAgentInfo = navigator.userAgent;
3
- var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
4
- var flag = true;
5
- for (let v = 0; v < Agents.length - 1; v++) {
6
- if (userAgentInfo.indexOf(Agents[v]) > 0) {
7
- flag = false;
8
- break;
9
- }
10
- }
11
- return flag;
12
- }