@10yun/cv-mobile-ui 0.5.62 → 0.5.63

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 (67) hide show
  1. package/package.json +1 -1
  2. package/plugins/uni-extend.js +10 -10
  3. package/ui-fireui/components/u-action-sheet/u-action-sheet.vue +46 -16
  4. package/ui-fireui/components/u-alert/u-alert.vue +11 -5
  5. package/ui-fireui/components/u-badge/u-badge.vue +52 -69
  6. package/ui-fireui/components/u-bottom-navigation/u-bottom-navigation.vue +28 -20
  7. package/ui-fireui/components/u-bottom-popup/u-bottom-popup.vue +40 -11
  8. package/ui-fireui/components/u-bubble-popup/u-bubble-popup.vue +3 -6
  9. package/ui-fireui/components/u-button/u-button.vue +262 -259
  10. package/ui-fireui/components/u-calendar/u-calendar.vue +227 -44
  11. package/ui-fireui/components/u-calendar/u-calendar2.js +562 -0
  12. package/ui-fireui/components/u-card/u-card.vue +50 -32
  13. package/ui-fireui/components/u-cascade-selection/u-cascade-selection.vue +197 -74
  14. package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +324 -0
  15. package/ui-fireui/components/u-clipboard2/tui-clipboard.js +53 -0
  16. package/ui-fireui/components/u-collapse/u-collapse.vue +8 -8
  17. package/ui-fireui/components/u-config/index.js +129 -0
  18. package/ui-fireui/components/u-count-down/u-count-down.vue +124 -19
  19. package/ui-fireui/components/u-datetime/u-datetime.vue +416 -176
  20. package/ui-fireui/components/u-divider/u-divider.vue +3 -3
  21. package/ui-fireui/components/u-drawer/u-drawer.vue +55 -12
  22. package/ui-fireui/components/u-dropdown-list/u-dropdown-list.vue +103 -0
  23. package/ui-fireui/components/u-fab/u-fab.vue +344 -0
  24. package/ui-fireui/components/u-footer/u-footer.vue +148 -0
  25. package/ui-fireui/components/u-grid/u-grid.vue +2 -8
  26. package/ui-fireui/components/u-grid-item/u-grid-item.vue +22 -5
  27. package/ui-fireui/components/u-icon/u-icon-new.js +190 -0
  28. package/ui-fireui/components/u-icon/u-icon-new.vue +100 -0
  29. package/ui-fireui/components/u-image-cropper/u-image-cropper.vue +1144 -0
  30. package/ui-fireui/components/u-image-group/u-image-group.vue +164 -0
  31. package/ui-fireui/components/u-keyboard/u-keyboard.vue +3 -2
  32. package/ui-fireui/components/u-keyboard-input/u-keyboard-input.vue +1 -1
  33. package/ui-fireui/components/u-list-cell/u-list-cell.vue +82 -72
  34. package/ui-fireui/components/u-list-view/u-list-view.vue +33 -8
  35. package/ui-fireui/components/u-loading/u-loading.vue +107 -27
  36. package/ui-fireui/components/u-loadmore/u-loadmore.vue +21 -3
  37. package/ui-fireui/components/u-modal/u-modal.vue +140 -176
  38. package/ui-fireui/components/u-navigation-bar/u-navigation-bar.vue +121 -28
  39. package/ui-fireui/components/u-no-data/u-no-data.vue +58 -20
  40. package/ui-fireui/components/u-nomore/u-nomore.vue +5 -4
  41. package/ui-fireui/components/u-numberbox/u-numberbox.vue +88 -45
  42. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.vue +94 -36
  43. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +27 -17
  44. package/ui-fireui/components/u-rate/u-rate.vue +197 -0
  45. package/ui-fireui/components/u-round-progress/u-round-progress.vue +62 -42
  46. package/ui-fireui/components/u-scroll-top/u-scroll-top.vue +4 -3
  47. package/ui-fireui/components/u-section/u-section.vue +149 -0
  48. package/ui-fireui/components/u-skeleton/u-skeleton.vue +37 -6
  49. package/ui-fireui/components/u-steps/u-steps.vue +110 -27
  50. package/ui-fireui/components/u-sticky/u-sticky.vue +35 -21
  51. package/ui-fireui/components/u-sticky-wxs/u-sticky-wxs.vue +7 -4
  52. package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +39 -36
  53. package/ui-fireui/components/u-swipe-action/u-swipe-action.vue +76 -19
  54. package/ui-fireui/components/u-tabbar/u-tabbar.vue +71 -38
  55. package/ui-fireui/components/u-tabs/u-tabs.vue +133 -51
  56. package/ui-fireui/components/u-tag/u-tag.vue +109 -226
  57. package/ui-fireui/components/u-time-axis/u-time-axis.vue +1 -1
  58. package/ui-fireui/components/u-timeaxis-item/u-timeaxis-item.vue +1 -1
  59. package/ui-fireui/components/u-tips/u-tips.vue +35 -15
  60. package/ui-fireui/components/u-toast/u-toast.vue +9 -5
  61. package/ui-fireui/components/u-top-dropdown/u-top-dropdown.vue +8 -6
  62. package/ui-fireui/components/u-upload/u-upload-old.vue +462 -0
  63. package/ui-fireui/components/u-upload/u-upload.vue +648 -446
  64. package/ui-fireui/components/u-white-space/u-white-space.vue +68 -0
  65. package/ui-fireui/components/u-wing-blank/u-wing-blank.vue +100 -0
  66. package/uview-plus/libs/ctocode/index.js +1 -0
  67. package/uview-plus/libs/ctocode/richText.js +0 -1
@@ -6,28 +6,50 @@
6
6
  :class="[direction === 'row' ? 'up-step-horizontal' : 'up-step-vertical']"
7
7
  v-for="(item, index) in items"
8
8
  :key="index"
9
+ @tap.stop="handleClick(index)"
9
10
  >
10
- <view class="up-step-item-ico" :style="{ width: direction === 'column' ? '36rpx' : '100%' }">
11
+ <view
12
+ class="up-step-item-ico"
13
+ :class="[direction === 'column' ? 'up-step-column_ico' : 'up-step-row_ico']"
14
+ :style="{ width: direction === 'column' ? '36rpx' : '100%' }"
15
+ >
11
16
  <view
17
+ v-if="!item.name && !item.icon"
12
18
  class="up-step-ico"
13
- :class="[direction === 'column' ? 'up-step-column_ico' : 'up-step-row_ico']"
14
19
  :style="{
15
20
  width: type == 2 || activeSteps === index ? '36rpx' : '16rpx',
16
21
  height: type == 2 || activeSteps === index ? '36rpx' : '16rpx',
17
- backgroundColor: index <= activeSteps ? activeColor : type == 2 ? '#fff' : deactiveColor,
18
- borderColor: index <= activeSteps ? activeColor : deactiveColor
22
+ backgroundColor: index <= activeSteps ? getActiveColor : type == 2 ? '#fff' : deactiveColor,
23
+ borderColor: index <= activeSteps ? getActiveColor : deactiveColor
19
24
  }"
20
25
  >
21
- <!-- <icon type="success_no_circle" :size="12" color="#fff"></icon> -->
22
26
  <text v-if="activeSteps !== index" :style="{ color: index <= activeSteps ? '#fff' : '' }">
23
27
  {{ type == 1 ? '' : index + 1 }}
24
28
  </text>
25
29
  <up-icon name="check" :size="16" color="#fff" v-if="activeSteps === index"></up-icon>
26
30
  </view>
31
+ <view class="up-step-custom" :style="{ backgroundColor: backgroundColor }" v-if="item.name || item.icon">
32
+ <up-icon
33
+ :name="item.name"
34
+ :size="item.size || 20"
35
+ :color="index <= activeSteps ? getActiveColor : deactiveColor"
36
+ v-if="item.name"
37
+ ></up-icon>
38
+ <image
39
+ :src="index <= activeSteps ? item.activeIcon : item.icon"
40
+ class="up-step-img"
41
+ mode="widthFix"
42
+ v-if="!item.name"
43
+ ></image>
44
+ </view>
27
45
  <view
28
46
  class="up-step-line"
29
- :class="['up-step-' + direction + '_line']"
30
- :style="{ backgroundColor: index <= activeSteps - 1 ? activeColor : deactiveColor }"
47
+ :class="['up-step-' + direction + '_line', direction == 'column' && (item.name || item.icon) ? 'up-custom-left' : '']"
48
+ :style="{
49
+ borderColor: index <= activeSteps - 1 ? getActiveColor : deactiveColor,
50
+ borderRightStyle: direction == 'column' ? lineStyle : '',
51
+ borderTopStyle: direction == 'column' ? '' : lineStyle
52
+ }"
31
53
  v-if="index != items.length - 1"
32
54
  ></view>
33
55
  </view>
@@ -35,19 +57,19 @@
35
57
  <view
36
58
  class="up-step-item-title"
37
59
  :style="{
38
- color: index <= activeSteps ? activeColor : deactiveColor,
60
+ color: index <= activeSteps ? getActiveColor : deactiveColor,
39
61
  fontSize: titleSize + 'rpx',
40
62
  lineHeight: titleSize + 'rpx',
41
63
  fontWeight: bold ? 'bold' : 'normal'
42
64
  }"
43
65
  >
44
- {{ item.title }}
66
+ {{ item[titleField] }}
45
67
  </view>
46
68
  <view
47
69
  class="up-step-item-content"
48
- :style="{ color: index <= activeSteps ? activeColor : deactiveColor, fontSize: descSize + 'rpx' }"
70
+ :style="{ color: index <= activeSteps ? getActiveColor : deactiveColor, fontSize: descSize + 'rpx' }"
49
71
  >
50
- {{ item.desc }}
72
+ {{ item[descrField] }}
51
73
  </view>
52
74
  </view>
53
75
  </view>
@@ -57,7 +79,8 @@
57
79
  <script>
58
80
  //如果自定义传入图标内容,则需要拆分组件
59
81
  export default {
60
- name: 'fuiSteps',
82
+ name: 'tuiSteps',
83
+ emits: ['click'],
61
84
  props: {
62
85
  // 1-默认步骤 2-数字步骤
63
86
  type: {
@@ -76,7 +99,7 @@ export default {
76
99
  // 激活状态成功颜色
77
100
  activeColor: {
78
101
  type: String,
79
- default: '#5677fc'
102
+ default: ''
80
103
  },
81
104
  // 未激活状态颜色
82
105
  deactiveColor: {
@@ -103,21 +126,55 @@ export default {
103
126
  type: Number,
104
127
  default: -1
105
128
  },
129
+ //线条样式 同border线条样式
130
+ lineStyle: {
131
+ type: String,
132
+ default: 'solid'
133
+ },
106
134
  /**
107
- * [{
108
- title: "标题",
109
- desc: "描述"
110
- }]
111
- * */
135
+ * [{
136
+ title: "标题",
137
+ desc: "描述",
138
+ name:"字体图标 thorui icon内",
139
+ size:字体图标大小,单位px
140
+ icon:"图片图标",
141
+ activeIcon:"已完成步骤显示图片图标"
142
+ }]
143
+ * */
112
144
  items: {
113
145
  type: Array,
114
146
  default() {
115
147
  return [];
116
148
  }
149
+ },
150
+ titleField: {
151
+ type: String,
152
+ default: 'title'
153
+ },
154
+ descrField: {
155
+ type: String,
156
+ default: 'desc'
157
+ },
158
+ //自定义item内容时背景色
159
+ backgroundColor: {
160
+ type: String,
161
+ default: '#fff'
162
+ }
163
+ },
164
+ computed: {
165
+ getActiveColor() {
166
+ return this.activeColor || (uni && uni.$tui && uni.$tui.color.primary) || '#5677fc';
117
167
  }
118
168
  },
119
169
  data() {
120
170
  return {};
171
+ },
172
+ methods: {
173
+ handleClick(index) {
174
+ this.$emit('click', {
175
+ index: index
176
+ });
177
+ }
121
178
  }
122
179
  };
123
180
  </script>
@@ -134,24 +191,24 @@ export default {
134
191
  }
135
192
 
136
193
  .up-step-ico {
137
- border-radius: 40rpx;
194
+ border-radius: 50%;
138
195
  position: relative;
139
196
  z-index: 3;
140
197
  margin: 0 auto;
141
198
  border-width: 1rpx;
142
199
  border-style: solid;
143
- display: flex;
200
+ display: inline-flex;
144
201
  align-items: center;
145
202
  justify-content: center;
203
+ flex-shrink: 0;
146
204
  }
147
205
 
148
206
  .up-step-row_ico {
149
- top: 50%;
150
- transform: translateY(-50%);
207
+ align-items: center;
151
208
  }
152
209
 
153
210
  .up-step-column_ico {
154
- top: 0;
211
+ align-items: flex-start;
155
212
  }
156
213
 
157
214
  .up-step-line {
@@ -159,7 +216,10 @@ export default {
159
216
  left: 50%;
160
217
  top: 20rpx;
161
218
  width: 100%;
162
- height: 1rpx;
219
+ height: 0rpx;
220
+ border-top-width: 1px;
221
+ z-index: 2;
222
+ transform: translateY(-50%) translateZ(0);
163
223
  }
164
224
 
165
225
  .up-step-row_item_main {
@@ -174,8 +234,24 @@ export default {
174
234
 
175
235
  .up-step-item-ico {
176
236
  height: 36rpx;
177
- line-height: 36rpx;
178
- text-align: center;
237
+ display: flex;
238
+ justify-content: center;
239
+ }
240
+
241
+ .up-step-custom {
242
+ display: flex;
243
+ align-items: center;
244
+ justify-content: center;
245
+ width: 48rpx;
246
+ height: 40rpx;
247
+ position: relative;
248
+ z-index: 4;
249
+ margin: 0 auto;
250
+ }
251
+
252
+ .up-step-img {
253
+ width: 40rpx;
254
+ height: 40rpx;
179
255
  }
180
256
 
181
257
  .up-step-item-main {
@@ -201,6 +277,7 @@ export default {
201
277
  .up-step-column_item_main {
202
278
  margin-top: 0;
203
279
  padding-left: 20rpx;
280
+ max-width: 80%;
204
281
  }
205
282
 
206
283
  .up-step-column_line {
@@ -209,6 +286,12 @@ export default {
209
286
  top: 0;
210
287
  left: 18rpx;
211
288
  margin: 0;
212
- width: 1rpx;
289
+ width: 0rpx;
290
+ border-right-width: 1px;
291
+ transform: none !important;
292
+ }
293
+
294
+ .up-custom-left {
295
+ left: 20rpx !important;
213
296
  }
214
297
  </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <view class="up-sticky-class">
2
+ <view class="up-sticky-class" :id="tui_Id">
3
3
  <!--sticky 容器-->
4
- <view :style="{ height: stickyHeight, backgroundColor: backgroundColor }" v-if="isFixed"></view>
4
+ <view :style="{ height: stickyHeight, background: backgroundColor }" v-if="isFixed"></view>
5
5
  <view :class="{ 'up-sticky-fixed': isFixed }" :style="{ top: isFixed ? stickyTop + 'px' : 'auto' }">
6
6
  <slot name="header"></slot>
7
7
  </view>
@@ -13,7 +13,8 @@
13
13
 
14
14
  <script>
15
15
  export default {
16
- name: 'fuiSticky',
16
+ name: 'tuiSticky',
17
+ emits: ['sticky', 'change'],
17
18
  props: {
18
19
  scrollTop: {
19
20
  type: Number
@@ -81,17 +82,21 @@ export default {
81
82
  this.initialize = this.recalc;
82
83
  },
83
84
  mounted() {
84
- setTimeout(() => {
85
- this.updateScrollChange();
86
- }, 20);
85
+ this.$nextTick(() => {
86
+ setTimeout(() => {
87
+ this.updateScrollChange();
88
+ }, 50);
89
+ });
87
90
  },
88
91
  data() {
92
+ const Id = `tui_${Math.ceil(Math.random() * 10e5).toString(36)}`;
89
93
  return {
90
94
  timer: null,
91
95
  top: 0,
92
96
  height: 0,
93
97
  isFixed: false,
94
- initialize: 0 //重新初始化
98
+ initialize: 0, //重新初始化
99
+ tui_Id: Id
95
100
  };
96
101
  },
97
102
  methods: {
@@ -123,21 +128,30 @@ export default {
123
128
  this.timer = null;
124
129
  }
125
130
  this.timer = setTimeout(() => {
126
- const className = '.up-sticky-class';
127
- const query = uni.createSelectorQuery().in(this);
128
- query
129
- .select(className)
130
- .boundingClientRect((res) => {
131
- if (res) {
132
- this.top = res.top + (this.scrollTop || 0);
133
- this.height = res.height;
134
- callback && callback();
135
- this.$emit('change', {
136
- index: Number(this.index),
137
- top: this.top
138
- });
131
+ const selectId = `#${this.tui_Id}`;
132
+ uni
133
+ .createSelectorQuery()
134
+ // #ifndef MP-ALIPAY
135
+ .in(this)
136
+ // #endif
137
+ .select(selectId)
138
+ .fields(
139
+ {
140
+ size: true,
141
+ rect: true
142
+ },
143
+ (res) => {
144
+ if (res) {
145
+ this.top = res.top + (this.scrollTop || 0);
146
+ this.height = res.height;
147
+ callback && callback();
148
+ this.$emit('change', {
149
+ index: Number(this.index),
150
+ top: this.top
151
+ });
152
+ }
139
153
  }
140
- })
154
+ )
141
155
  .exec();
142
156
  }, 0);
143
157
  }
@@ -23,7 +23,8 @@
23
23
  <script src="./up-sticky.wxs" module="parse" lang="wxs"></script>
24
24
  <script>
25
25
  export default {
26
- name: 'fuiStickyWxs',
26
+ name: 'tuiStickyWxs',
27
+ emits: ['prop', 'change'],
27
28
  props: {
28
29
  scrollTop: {
29
30
  type: [Number, String],
@@ -79,9 +80,11 @@ export default {
79
80
  }
80
81
  },
81
82
  mounted() {
82
- setTimeout(() => {
83
- this.updateScrollChange();
84
- }, 20);
83
+ this.$nextTick(() => {
84
+ setTimeout(() => {
85
+ this.updateScrollChange();
86
+ }, 50);
87
+ });
85
88
  },
86
89
  data() {
87
90
  return {
@@ -1,46 +1,49 @@
1
- var stickyChange = function (scrollTop, oldScrollTop, ownerInstance, ins) {
2
- if(!oldScrollTop) return false;
1
+ var isH5 = false;
2
+ if (typeof window === 'object') isH5 = true;
3
+ var stickyChange = function(scrollTop, oldScrollTop, ownerInstance, ins) {
4
+ if (!oldScrollTop && scrollTop === 0) return false;
3
5
  var dataset = ins.getDataset()
4
- var top =+dataset.top;
5
- var height = + dataset.height;
6
+ var top = +dataset.top;
7
+ var height = +dataset.height;
6
8
  var stickyTop = +dataset.stickytop;
7
- var isNativeHeader=dataset.isnativeheader;
9
+ var isNativeHeader = dataset.isnativeheader;
8
10
  var isFixed = false;
9
- var distance=stickyTop
10
- // #ifdef H5
11
- if (isNativeHeader) {
11
+ var distance = stickyTop
12
+ if (isNativeHeader && isH5) {
12
13
  distance = distance - 44
13
14
  distance = distance
14
15
  < 0 ? 0 : distance
15
- }
16
- // #endif
17
- if (dataset.container) {
18
- isFixed = (scrollTop + distance>= top && scrollTop + distance
16
+ }
17
+ if (dataset.container) {
18
+ isFixed = (scrollTop + distance>= top && scrollTop + distance
19
19
  < top + height) ? true : false
20
- } else {
21
- isFixed = scrollTop + distance >= top ? true : false
22
- }
23
- if (isFixed) {
24
- ownerInstance.selectComponent('.up-sticky-bar').setStyle({
25
- "top": stickyTop + 'px'
26
- }).addClass('up-sticky-fixed')
27
- ownerInstance.selectComponent('.up-sticky-seat').setStyle({
28
- "display": 'block'
29
- })
30
- } else {
31
- ownerInstance.selectComponent('.up-sticky-bar').setStyle({
32
- "top": 'auto'
33
- }).removeClass('up-sticky-fixed')
34
- ownerInstance.selectComponent('.up-sticky-seat').setStyle({
35
- "display": 'none'
36
- })
37
- }
38
- ownerInstance.triggerEvent("sticky", {
39
- isFixed: isFixed,
40
- index: parseInt(dataset.index)
41
- })
20
+ } else {
21
+ isFixed = scrollTop + distance >= top ? true : false
22
+ }
23
+ var tsb = ownerInstance.selectComponent('.up-sticky-bar')
24
+ var tss = ownerInstance.selectComponent('.up-sticky-seat')
25
+ if (!tsb || !tss) return;
26
+ if (isFixed) {
27
+ tsb.setStyle({
28
+ "top": stickyTop + 'px'
29
+ }).addClass('up-sticky-fixed')
30
+ tss.setStyle({
31
+ "display": 'block'
32
+ })
33
+ } else {
34
+ tsb.setStyle({
35
+ "top": 'auto'
36
+ }).removeClass('up-sticky-fixed')
37
+ tss.setStyle({
38
+ "display": 'none'
39
+ })
40
+ }
41
+ ownerInstance.triggerEvent("sticky", [{
42
+ isFixed: isFixed,
43
+ index: parseInt(dataset.index)
44
+ }])
42
45
  }
43
46
 
44
- export default {
45
- stickyChange: stickyChange
47
+ module.exports = {
48
+ stickyChange: stickyChange
46
49
  }
@@ -1,14 +1,19 @@
1
1
  <template>
2
- <view class="up-swipeout-wrap" :class="swipeoutClass">
2
+ <view class="up-swipeout-wrap" :style="{ backgroundColor: backgroundColor }">
3
3
  <view
4
4
  class="up-swipeout-item"
5
5
  :class="[isShowBtn ? 'swipe-action-show' : '']"
6
- @touchstart="handlerTouchstart"
7
- @touchmove="handlerTouchmove"
8
- @touchend="handlerTouchend"
9
6
  :style="{ transform: 'translate(' + position.pageX + 'px,0)' }"
10
7
  >
11
- <view class="up-swipeout-content">
8
+ <view
9
+ class="up-swipeout-content"
10
+ @touchstart="handlerTouchstart"
11
+ @touchmove="handlerTouchmove"
12
+ @touchend="handlerTouchend"
13
+ @mousedown="handlerTouchstart"
14
+ @mousemove="handlerTouchmove"
15
+ @mouseup="handlerTouchend"
16
+ >
12
17
  <slot name="content"></slot>
13
18
  </view>
14
19
  <view class="up-swipeout-button-right-group" v-if="actions.length > 0" @touchend.stop="loop">
@@ -16,12 +21,20 @@
16
21
  class="up-swipeout-button-right-item"
17
22
  v-for="(item, index) in actions"
18
23
  :key="index"
19
- :style="{ backgroundColor: item.background || '#f7f7f7', color: item.color, width: item.width + 'px' }"
24
+ :style="{
25
+ backgroundColor: item.background || '#f7f7f7',
26
+ color: item.color || color,
27
+ width: (item.width || width) + 'px'
28
+ }"
20
29
  :data-index="index"
21
30
  @tap="handlerButton"
22
31
  >
23
- <image :src="item.icon" v-if="item.icon" :style="{ width: px(item.imgWidth), height: px(item.imgHeight) }"></image>
24
- <text :style="{ fontSize: px(item.fontsize) }">{{ item.name }}</text>
32
+ <image
33
+ :src="item[iconField]"
34
+ v-if="item[iconField]"
35
+ :style="{ width: px(item.imgWidth || 48), height: px(item.imgHeight || 48) }"
36
+ ></image>
37
+ <text :style="{ fontSize: px(item.fontsize || 32) }">{{ item[nameField] }}</text>
25
38
  </view>
26
39
  </view>
27
40
  <!--actions长度设置为0,可直接传按钮进来-->
@@ -40,13 +53,14 @@
40
53
  class="swipe-action_mask"
41
54
  @tap.stop="closeButtonGroup"
42
55
  @touchstart.stop.prevent="closeButtonGroup"
43
- />
56
+ ></view>
44
57
  </view>
45
58
  </template>
46
59
 
47
60
  <script>
48
61
  export default {
49
- name: 'fuiSwipeAction',
62
+ name: 'tuiSwipeAction',
63
+ emits: ['click'],
50
64
  props: {
51
65
  // name: '删除',
52
66
  // color: '#fff',
@@ -60,9 +74,21 @@ export default {
60
74
  return [];
61
75
  }
62
76
  },
63
- swipeoutClass: {
77
+ nameField: {
64
78
  type: String,
65
- default: ''
79
+ default: 'name'
80
+ },
81
+ color: {
82
+ type: String,
83
+ default: '#fff'
84
+ },
85
+ iconField: {
86
+ type: String,
87
+ default: 'icon'
88
+ },
89
+ width: {
90
+ type: [String, Number],
91
+ default: 70
66
92
  },
67
93
  //点击按钮时是否自动关闭
68
94
  closable: {
@@ -93,6 +119,11 @@ export default {
93
119
  open: {
94
120
  type: Boolean,
95
121
  default: false
122
+ },
123
+ //背景色
124
+ backgroundColor: {
125
+ type: String,
126
+ default: '#fff'
96
127
  }
97
128
  },
98
129
  watch: {
@@ -117,7 +148,8 @@ export default {
117
148
  pageX: 0,
118
149
  pageY: 0
119
150
  },
120
- isShowBtn: false
151
+ isShowBtn: false,
152
+ move: false
121
153
  };
122
154
  },
123
155
  mounted() {
@@ -144,7 +176,16 @@ export default {
144
176
  },
145
177
  handlerTouchstart(event) {
146
178
  if (this.forbid) return;
147
- const touches = event.touches ? event.touches[0] : {};
179
+ let touches = event.touches;
180
+ if (touches && touches.length > 1) return;
181
+ this.move = true;
182
+ touches = touches ? event.touches[0] : {};
183
+ if (!touches || (touches.pageX === undefined && touches.pageY === undefined)) {
184
+ touches = {
185
+ pageX: event.pageX,
186
+ pageY: event.pageY
187
+ };
188
+ }
148
189
  const tStart = this.tStart;
149
190
  if (touches) {
150
191
  for (let i in tStart) {
@@ -166,9 +207,15 @@ export default {
166
207
  this.position = spacing;
167
208
  },
168
209
  handlerTouchmove(event) {
169
- if (this.forbid) return;
210
+ if (this.forbid || !this.move) return;
170
211
  const start = this.tStart;
171
- const touches = event.touches ? event.touches[0] : {};
212
+ let touches = event.touches ? event.touches[0] : {};
213
+ if (!touches || (touches.pageX === undefined && touches.pageY === undefined)) {
214
+ touches = {
215
+ pageX: event.pageX,
216
+ pageY: event.pageY
217
+ };
218
+ }
172
219
  if (touches) {
173
220
  const direction = this.swipeDirection(start.pageX, touches.pageX, start.pageY, touches.pageY);
174
221
  if (direction === 'Left' && Math.abs(this.position.pageX) !== this.limitMove) {
@@ -177,9 +224,16 @@ export default {
177
224
  }
178
225
  },
179
226
  handlerTouchend(event) {
180
- if (this.forbid) return;
227
+ if (this.forbid || !this.move) return;
228
+ this.move = false;
181
229
  const start = this.tStart;
182
- const touches = event.changedTouches ? event.changedTouches[0] : {};
230
+ let touches = event.changedTouches ? event.changedTouches[0] : {};
231
+ if (!touches || (touches.pageX === undefined && touches.pageY === undefined)) {
232
+ touches = {
233
+ pageX: event.pageX,
234
+ pageY: event.pageY
235
+ };
236
+ }
183
237
  if (touches) {
184
238
  const direction = this.swipeDirection(start.pageX, touches.pageX, start.pageY, touches.pageY);
185
239
  const spacing = {
@@ -192,6 +246,9 @@ export default {
192
246
  } else {
193
247
  spacing.pageX = 0;
194
248
  }
249
+ if (spacing.pageX == 0) {
250
+ this.isShowBtn = false;
251
+ }
195
252
  this.position = spacing;
196
253
  }
197
254
  },
@@ -245,7 +302,6 @@ export default {
245
302
 
246
303
  <style scoped>
247
304
  .up-swipeout-wrap {
248
- background-color: #fff;
249
305
  position: relative;
250
306
  overflow: hidden;
251
307
  }
@@ -261,6 +317,7 @@ export default {
261
317
  box-sizing: border-box;
262
318
  transition: transform 0.2s ease;
263
319
  font-size: 14px;
320
+ cursor: pointer;
264
321
  }
265
322
 
266
323
  .up-swipeout-content {