@10yun/cv-mobile-ui 0.5.19 → 0.5.21

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 (137) hide show
  1. package/other/mpvue-picker/mpvuePicker.vue +402 -0
  2. package/{uni-ui/lib → other}/mpvue-picker/style.css +0 -1
  3. package/{uni-ui/lib → other}/tab-nvue/style.css +0 -1
  4. package/other/uParse/components/style.css +1 -0
  5. package/other/uParse/components/wxParseAudio.vue +1 -0
  6. package/other/uParse/components/wxParseImg.vue +86 -0
  7. package/other/uParse/components/wxParseTable.vue +54 -0
  8. package/other/uParse/components/wxParseTemplate0.vue +98 -0
  9. package/other/uParse/components/wxParseTemplate1.vue +81 -0
  10. package/other/uParse/components/wxParseTemplate10.vue +81 -0
  11. package/other/uParse/components/wxParseTemplate11.vue +79 -0
  12. package/other/uParse/components/wxParseTemplate2.vue +81 -0
  13. package/other/uParse/components/wxParseTemplate3.vue +81 -0
  14. package/other/uParse/components/wxParseTemplate4.vue +81 -0
  15. package/other/uParse/components/wxParseTemplate5.vue +81 -0
  16. package/other/uParse/components/wxParseTemplate6.vue +81 -0
  17. package/other/uParse/components/wxParseTemplate7.vue +81 -0
  18. package/other/uParse/components/wxParseTemplate8.vue +81 -0
  19. package/other/uParse/components/wxParseTemplate9.vue +81 -0
  20. package/other/uParse/components/wxParseVideo.vue +14 -0
  21. package/other/uParse/editor.css +495 -0
  22. package/{uni-ui/lib/uParse/src → other/uParse}/libs/html2json.js +19 -22
  23. package/{uni-ui/lib/uParse/src → other/uParse}/libs/htmlparser.js +12 -5
  24. package/{uni-ui/lib/uParse/src → other/uParse}/libs/wxDiscode.js +2 -2
  25. package/other/uParse/wxParse.vue +196 -0
  26. package/package.json +1 -1
  27. package/plugins/map/amqp-wx.js +173 -0
  28. package/{uni-ui/lib/mpvueGestureLock/index.vue → ui-cv/components/cv-draw-gesture-lock/cv-draw-gesture-lock.vue} +4 -1
  29. package/ui-cv/components/cv-draw-gesture-lock/gestureLock.js +169 -0
  30. package/{uni-ui/lib/mpvueGestureLock → ui-cv/components/cv-draw-gesture-lock}/style.css +0 -1
  31. package/{uni-ui/lib/mpvue-citypicker → ui-cv/components/cv-geo-region}/style.css +0 -1
  32. package/ui-cv/components/cv-grid-item/cv-grid-item.vue +1 -1
  33. package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
  34. package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
  35. package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
  36. package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
  37. package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
  38. package/uni-ui/lib/uni-card/uni-card.vue +124 -1
  39. package/uni-ui/lib/uni-col/uni-col.vue +1 -1
  40. package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
  41. package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
  42. package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
  43. package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
  44. package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
  45. package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
  46. package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
  47. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
  48. package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
  49. package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
  50. package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
  51. package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
  52. package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
  53. package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
  54. package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
  55. package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
  56. package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
  57. package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
  58. package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
  59. package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
  60. package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
  61. package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
  62. package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
  63. package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
  64. package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
  65. package/uni-ui/lib/uni-group/uni-group.vue +85 -1
  66. package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
  67. package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
  68. package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
  69. package/uni-ui/lib/uni-list/uni-list.vue +81 -1
  70. package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
  71. package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
  72. package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
  73. package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
  74. package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
  75. package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
  76. package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
  77. package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
  78. package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
  79. package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
  80. package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
  81. package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
  82. package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
  83. package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
  84. package/uni-ui/lib/uni-row/uni-row.vue +1 -1
  85. package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
  86. package/uni-ui/lib/uni-section/uni-section.vue +109 -1
  87. package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
  88. package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
  89. package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
  90. package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
  91. package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
  92. package/uni-ui/lib/uni-table/uni-table.vue +297 -1
  93. package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
  94. package/uni-ui/lib/uni-td/uni-td.vue +78 -1
  95. package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
  96. package/uni-ui/lib/uni-th/uni-th.vue +224 -1
  97. package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
  98. package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
  99. package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
  100. package/uni-ui/lib/amap-wx/js/util.js +0 -181
  101. package/uni-ui/lib/marked/index.js +0 -1
  102. package/uni-ui/lib/mpvue-citypicker/city-data/area.js +0 -12542
  103. package/uni-ui/lib/mpvue-citypicker/city-data/city.js +0 -1503
  104. package/uni-ui/lib/mpvue-citypicker/city-data/province.js +0 -139
  105. package/uni-ui/lib/mpvue-picker/mpvuePicker.vue +0 -3
  106. package/uni-ui/lib/mpvueGestureLock/gestureLock.js +0 -175
  107. package/uni-ui/lib/uParse/src/components/style.css +0 -2
  108. package/uni-ui/lib/uParse/src/components/wxParseAudio.vue +0 -1
  109. package/uni-ui/lib/uParse/src/components/wxParseImg.vue +0 -1
  110. package/uni-ui/lib/uParse/src/components/wxParseTable.vue +0 -3
  111. package/uni-ui/lib/uParse/src/components/wxParseTemplate0.vue +0 -1
  112. package/uni-ui/lib/uParse/src/components/wxParseTemplate1.vue +0 -1
  113. package/uni-ui/lib/uParse/src/components/wxParseTemplate10.vue +0 -1
  114. package/uni-ui/lib/uParse/src/components/wxParseTemplate11.vue +0 -1
  115. package/uni-ui/lib/uParse/src/components/wxParseTemplate2.vue +0 -1
  116. package/uni-ui/lib/uParse/src/components/wxParseTemplate3.vue +0 -1
  117. package/uni-ui/lib/uParse/src/components/wxParseTemplate4.vue +0 -1
  118. package/uni-ui/lib/uParse/src/components/wxParseTemplate5.vue +0 -1
  119. package/uni-ui/lib/uParse/src/components/wxParseTemplate6.vue +0 -1
  120. package/uni-ui/lib/uParse/src/components/wxParseTemplate7.vue +0 -1
  121. package/uni-ui/lib/uParse/src/components/wxParseTemplate8.vue +0 -1
  122. package/uni-ui/lib/uParse/src/components/wxParseTemplate9.vue +0 -1
  123. package/uni-ui/lib/uParse/src/components/wxParseVideo.vue +0 -1
  124. package/uni-ui/lib/uParse/src/editor.css +0 -495
  125. package/uni-ui/lib/uParse/src/wxParse.vue +0 -1
  126. /package/{uni-ui/lib → other}/api-set-tabbar.nvue +0 -0
  127. /package/{uni-ui/lib → other}/mpvue-echarts/src/echarts.vue +0 -0
  128. /package/{uni-ui/lib → other}/mpvue-echarts/src/style.css +0 -0
  129. /package/{uni-ui/lib → other}/mpvue-echarts/src/wx-canvas.js +0 -0
  130. /package/{uni-ui/lib → other}/product.vue +0 -0
  131. /package/{uni-ui/lib → other}/style.css +0 -0
  132. /package/{uni-ui/lib → other}/tab-nvue/mediaList.vue +0 -0
  133. /package/{uni-ui/lib → other}/u-charts/u-charts.js +0 -0
  134. /package/{uni-ui/lib/uParse/src → other/uParse}/wxParse.css +0 -0
  135. /package/{uni-ui/lib/amap-wx → plugins/map}/lib/amap-wx.js +0 -0
  136. /package/{uni-ui/lib/mpvue-citypicker → ui-cv/components/cv-geo-region}/mpvueCityPicker.vue +0 -0
  137. /package/{uni-ui/lib/marked → ui-cv/components/cv-markdown-show}/lib/marked.js +0 -0
@@ -1 +1,257 @@
1
- <template>
2
1
  <view class="uni-cursor-point">
3
2
  <view
4
3
  v-if="popMenu && (leftBottom || rightBottom || leftTop || rightTop) && content.length > 0"
5
4
  :class="{
6
5
  'uni-fab--leftBottom': leftBottom,
7
6
  'uni-fab--rightBottom': rightBottom,
8
7
  'uni-fab--leftTop': leftTop,
9
8
  'uni-fab--rightTop': rightTop
10
9
  }"
11
10
  class="uni-fab"
12
11
  :style="nvueBottom"
13
12
  >
14
13
  <view
15
14
  :class="{
16
15
  'uni-fab__content--left': horizontal === 'left',
17
16
  'uni-fab__content--right': horizontal === 'right',
18
17
  'uni-fab__content--flexDirection': direction === 'vertical',
19
18
  'uni-fab__content--flexDirectionStart': flexDirectionStart,
20
19
  'uni-fab__content--flexDirectionEnd': flexDirectionEnd,
21
20
  'uni-fab__content--other-platform': !isAndroidNvue
22
21
  }"
23
22
  :style="{ width: boxWidth, height: boxHeight, backgroundColor: styles.backgroundColor }"
24
23
  class="uni-fab__content"
25
24
  elevation="5"
26
25
  >
27
26
  <view v-if="flexDirectionStart || horizontalLeft" class="uni-fab__item uni-fab__item--first" />
28
27
  <view
29
28
  v-for="(item, index) in content"
30
29
  :key="index"
31
30
  :class="{ 'uni-fab__item--active': isShow }"
32
31
  class="uni-fab__item"
33
32
  @click="_onItemClick(index, item)"
34
33
  >
35
34
  <image :src="item.active ? item.selectedIconPath : item.iconPath" class="uni-fab__item-image" mode="aspectFit" />
36
35
  <text class="uni-fab__item-text" :style="{ color: item.active ? styles.selectedColor : styles.color }">
37
36
  {{ item.text }}
38
37
  </text>
39
38
  </view>
40
39
  <view v-if="flexDirectionEnd || horizontalRight" class="uni-fab__item uni-fab__item--first" />
41
40
  </view>
42
41
  </view>
43
42
  <view
44
43
  :class="{
45
44
  'uni-fab__circle--leftBottom': leftBottom,
46
45
  'uni-fab__circle--rightBottom': rightBottom,
47
46
  'uni-fab__circle--leftTop': leftTop,
48
47
  'uni-fab__circle--rightTop': rightTop,
49
48
  'uni-fab__content--other-platform': !isAndroidNvue
50
49
  }"
51
50
  class="uni-fab__circle uni-fab__plus"
52
51
  :style="{ 'background-color': styles.buttonColor, bottom: nvueBottom }"
53
52
  @click="_onClick"
54
53
  >
55
54
  <uni-icons
56
55
  class="fab-circle-icon"
57
56
  :type="styles.icon"
58
57
  :color="styles.iconColor"
59
58
  size="32"
60
59
  :class="{ 'uni-fab__plus--active': isShow && content.length > 0 }"
61
60
  ></uni-icons>
62
61
  <!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
63
62
  </view>
64
63
  </view>
65
64
  * Fab 悬浮按钮
66
65
  * @description 点击可展开一个图形按钮菜单
67
66
  * @tutorial https://ext.dcloud.net.cn/plugin?id=144
68
67
  * @property {Object} pattern 可选样式配置项
69
68
  * @property {Object} horizontal = [left | right] 水平对齐方式
70
69
  * @value left 左对齐
71
70
  * @value right 右对齐
72
71
  * @property {Object} vertical = [bottom | top] 垂直对齐方式
73
72
  * @value bottom 下对齐
74
73
  * @value top 上对齐
75
74
  * @property {Object} direction = [horizontal | vertical] 展开菜单显示方式
76
75
  * @value horizontal 水平显示
77
76
  * @value vertical 垂直显示
78
77
  * @property {Array} content 展开菜单内容配置项
79
78
  * @property {Boolean} popMenu 是否使用弹出菜单
80
79
  * @event {Function} trigger 展开菜单点击事件,返回点击信息
81
80
  * @event {Function} fabClick 悬浮按钮点击事件
82
81
  */
83
82
  name: 'UniFab',
84
83
  emits: ['fabClick', 'trigger'],
85
84
  props: {
86
85
  pattern: {
87
86
  type: Object,
88
87
  default() {
89
88
  return {};
90
89
  }
91
90
  },
92
91
  horizontal: {
93
92
  type: String,
94
93
  default: 'left'
95
94
  },
96
95
  vertical: {
97
96
  type: String,
98
97
  default: 'bottom'
99
98
  },
100
99
  direction: {
101
100
  type: String,
102
101
  default: 'horizontal'
103
102
  },
104
103
  content: {
105
104
  type: Array,
106
105
  default() {
107
106
  return [];
108
107
  }
109
108
  },
110
109
  show: {
111
110
  type: Boolean,
112
111
  default: false
113
112
  },
114
113
  popMenu: {
115
114
  type: Boolean,
116
115
  default: true
117
116
  }
118
117
  },
119
118
  data() {
120
119
  return {
121
120
  fabShow: false,
122
121
  isShow: false,
123
122
  isAndroidNvue: platform === 'android',
124
123
  styles: {
125
124
  color: '#3c3e49',
126
125
  selectedColor: '#007AFF',
127
126
  backgroundColor: '#fff',
128
127
  buttonColor: '#007AFF',
129
128
  iconColor: '#fff',
130
129
  icon: 'plusempty'
131
130
  }
132
131
  };
133
132
  },
134
133
  computed: {
135
134
  contentWidth(e) {
136
135
  return (this.content.length + 1) * 55 + 15 + 'px';
137
136
  },
138
137
  contentWidthMin() {
139
138
  return '55px';
140
139
  },
141
140
  // 动态计算宽度
142
141
  boxWidth() {
143
142
  return this.getPosition(3, 'horizontal');
144
143
  },
145
144
  // 动态计算高度
146
145
  boxHeight() {
147
146
  return this.getPosition(3, 'vertical');
148
147
  },
149
148
  // 计算左下位置
150
149
  leftBottom() {
151
150
  return this.getPosition(0, 'left', 'bottom');
152
151
  },
153
152
  // 计算右下位置
154
153
  rightBottom() {
155
154
  return this.getPosition(0, 'right', 'bottom');
156
155
  },
157
156
  // 计算左上位置
158
157
  leftTop() {
159
158
  return this.getPosition(0, 'left', 'top');
160
159
  },
161
160
  rightTop() {
162
161
  return this.getPosition(0, 'right', 'top');
163
162
  },
164
163
  flexDirectionStart() {
165
164
  return this.getPosition(1, 'vertical', 'top');
166
165
  },
167
166
  flexDirectionEnd() {
168
167
  return this.getPosition(1, 'vertical', 'bottom');
169
168
  },
170
169
  horizontalLeft() {
171
170
  return this.getPosition(2, 'horizontal', 'left');
172
171
  },
173
172
  horizontalRight() {
174
173
  return this.getPosition(2, 'horizontal', 'right');
175
174
  },
176
175
  // 计算 nvue bottom
177
176
  nvueBottom() {
178
177
  const safeBottom = uni.getSystemInfoSync().windowBottom;
179
178
  // #ifdef APP-NVUE
180
179
  return 30 + safeBottom;
181
180
  // #endif
182
181
  // #ifndef APP-NVUE
183
182
  return 30;
184
183
  // #endif
185
184
  }
186
185
  },
187
186
  watch: {
188
187
  pattern: {
189
188
  handler(val, oldVal) {
190
189
  this.styles = Object.assign({}, this.styles, val);
191
190
  },
192
191
  deep: true
193
192
  }
194
193
  },
195
194
  created() {
196
195
  this.isShow = this.show;
197
196
  if (this.top === 0) {
198
197
  this.fabShow = true;
199
198
  }
200
199
  // 初始化样式
201
200
  this.styles = Object.assign({}, this.styles, this.pattern);
202
201
  },
203
202
  methods: {
204
203
  _onClick() {
205
204
  this.$emit('fabClick');
206
205
  if (!this.popMenu) {
207
206
  return;
208
207
  }
209
208
  this.isShow = !this.isShow;
210
209
  },
211
210
  open() {
212
211
  this.isShow = true;
213
212
  },
214
213
  close() {
215
214
  this.isShow = false;
216
215
  },
217
216
  /**
218
217
  * 按钮点击事件
219
218
  */
220
219
  _onItemClick(index, item) {
221
220
  if (!this.isShow) {
222
221
  return;
223
222
  }
224
223
  this.$emit('trigger', {
225
224
  index,
226
225
  item
227
226
  });
228
227
  },
229
228
  /**
230
229
  * 获取 位置信息
231
230
  */
232
231
  getPosition(types, paramA, paramB) {
233
232
  if (types === 0) {
234
233
  return this.horizontal === paramA && this.vertical === paramB;
235
234
  } else if (types === 1) {
236
235
  return this.direction === paramA && this.vertical === paramB;
237
236
  } else if (types === 2) {
238
237
  return this.direction === paramA && this.horizontal === paramB;
239
238
  } else {
240
239
  return this.isShow && this.direction === paramA ? this.contentWidth : this.contentWidthMin;
241
240
  }
242
241
  }
243
242
  }
243
+ <template>
244
+ <view class="uni-cursor-point">
245
+ <view
246
+ v-if="popMenu && (leftBottom || rightBottom || leftTop || rightTop) && content.length > 0"
247
+ :class="{
248
+ 'uni-fab--leftBottom': leftBottom,
249
+ 'uni-fab--rightBottom': rightBottom,
250
+ 'uni-fab--leftTop': leftTop,
251
+ 'uni-fab--rightTop': rightTop
252
+ }"
253
+ class="uni-fab"
254
+ :style="nvueBottom"
255
+ >
256
+ <view
257
+ :class="{
258
+ 'uni-fab__content--left': horizontal === 'left',
259
+ 'uni-fab__content--right': horizontal === 'right',
260
+ 'uni-fab__content--flexDirection': direction === 'vertical',
261
+ 'uni-fab__content--flexDirectionStart': flexDirectionStart,
262
+ 'uni-fab__content--flexDirectionEnd': flexDirectionEnd,
263
+ 'uni-fab__content--other-platform': !isAndroidNvue
264
+ }"
265
+ :style="{ width: boxWidth, height: boxHeight, backgroundColor: styles.backgroundColor }"
266
+ class="uni-fab__content"
267
+ elevation="5"
268
+ >
269
+ <view v-if="flexDirectionStart || horizontalLeft" class="uni-fab__item uni-fab__item--first" />
270
+ <view
271
+ v-for="(item, index) in content"
272
+ :key="index"
273
+ :class="{ 'uni-fab__item--active': isShow }"
274
+ class="uni-fab__item"
275
+ @click="_onItemClick(index, item)"
276
+ >
277
+ <image :src="item.active ? item.selectedIconPath : item.iconPath" class="uni-fab__item-image" mode="aspectFit" />
278
+ <text class="uni-fab__item-text" :style="{ color: item.active ? styles.selectedColor : styles.color }">
279
+ {{ item.text }}
280
+ </text>
281
+ </view>
282
+ <view v-if="flexDirectionEnd || horizontalRight" class="uni-fab__item uni-fab__item--first" />
283
+ </view>
284
+ </view>
285
+ <view
286
+ :class="{
287
+ 'uni-fab__circle--leftBottom': leftBottom,
288
+ 'uni-fab__circle--rightBottom': rightBottom,
289
+ 'uni-fab__circle--leftTop': leftTop,
290
+ 'uni-fab__circle--rightTop': rightTop,
291
+ 'uni-fab__content--other-platform': !isAndroidNvue
292
+ }"
293
+ class="uni-fab__circle uni-fab__plus"
294
+ :style="{ 'background-color': styles.buttonColor, bottom: nvueBottom }"
295
+ @click="_onClick"
296
+ >
297
+ <uni-icons
298
+ class="fab-circle-icon"
299
+ :type="styles.icon"
300
+ :color="styles.iconColor"
301
+ size="32"
302
+ :class="{ 'uni-fab__plus--active': isShow && content.length > 0 }"
303
+ ></uni-icons>
304
+ <!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
305
+ <view class="fab-circle-h" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> -->
306
+ </view>
307
+ </view>
308
+ </template>
309
+ <script>
310
+ let platform = 'other';
311
+ // #ifdef APP-NVUE
312
+ platform = uni.getSystemInfoSync().platform;
313
+ // #endif
314
+ /**
315
+ * Fab 悬浮按钮
316
+ * @description 点击可展开一个图形按钮菜单
317
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=144
318
+ * @property {Object} pattern 可选样式配置项
319
+ * @property {Object} horizontal = [left | right] 水平对齐方式
320
+ * @value left 左对齐
321
+ * @value right 右对齐
322
+ * @property {Object} vertical = [bottom | top] 垂直对齐方式
323
+ * @value bottom 下对齐
324
+ * @value top 上对齐
325
+ * @property {Object} direction = [horizontal | vertical] 展开菜单显示方式
326
+ * @value horizontal 水平显示
327
+ * @value vertical 垂直显示
328
+ * @property {Array} content 展开菜单内容配置项
329
+ * @property {Boolean} popMenu 是否使用弹出菜单
330
+ * @event {Function} trigger 展开菜单点击事件,返回点击信息
331
+ * @event {Function} fabClick 悬浮按钮点击事件
332
+ */
333
+ export default {
334
+ name: 'UniFab',
335
+ emits: ['fabClick', 'trigger'],
336
+ props: {
337
+ pattern: {
338
+ type: Object,
339
+ default() {
340
+ return {};
341
+ }
342
+ },
343
+ horizontal: {
344
+ type: String,
345
+ default: 'left'
346
+ },
347
+ vertical: {
348
+ type: String,
349
+ default: 'bottom'
350
+ },
351
+ direction: {
352
+ type: String,
353
+ default: 'horizontal'
354
+ },
355
+ content: {
356
+ type: Array,
357
+ default() {
358
+ return [];
359
+ }
360
+ },
361
+ show: {
362
+ type: Boolean,
363
+ default: false
364
+ },
365
+ popMenu: {
366
+ type: Boolean,
367
+ default: true
368
+ }
369
+ },
370
+ data() {
371
+ return {
372
+ fabShow: false,
373
+ isShow: false,
374
+ isAndroidNvue: platform === 'android',
375
+ styles: {
376
+ color: '#3c3e49',
377
+ selectedColor: '#007AFF',
378
+ backgroundColor: '#fff',
379
+ buttonColor: '#007AFF',
380
+ iconColor: '#fff',
381
+ icon: 'plusempty'
382
+ }
383
+ };
384
+ },
385
+ computed: {
386
+ contentWidth(e) {
387
+ return (this.content.length + 1) * 55 + 15 + 'px';
388
+ },
389
+ contentWidthMin() {
390
+ return '55px';
391
+ },
392
+ // 动态计算宽度
393
+ boxWidth() {
394
+ return this.getPosition(3, 'horizontal');
395
+ },
396
+ // 动态计算高度
397
+ boxHeight() {
398
+ return this.getPosition(3, 'vertical');
399
+ },
400
+ // 计算左下位置
401
+ leftBottom() {
402
+ return this.getPosition(0, 'left', 'bottom');
403
+ },
404
+ // 计算右下位置
405
+ rightBottom() {
406
+ return this.getPosition(0, 'right', 'bottom');
407
+ },
408
+ // 计算左上位置
409
+ leftTop() {
410
+ return this.getPosition(0, 'left', 'top');
411
+ },
412
+ rightTop() {
413
+ return this.getPosition(0, 'right', 'top');
414
+ },
415
+ flexDirectionStart() {
416
+ return this.getPosition(1, 'vertical', 'top');
417
+ },
418
+ flexDirectionEnd() {
419
+ return this.getPosition(1, 'vertical', 'bottom');
420
+ },
421
+ horizontalLeft() {
422
+ return this.getPosition(2, 'horizontal', 'left');
423
+ },
424
+ horizontalRight() {
425
+ return this.getPosition(2, 'horizontal', 'right');
426
+ },
427
+ // 计算 nvue bottom
428
+ nvueBottom() {
429
+ const safeBottom = uni.getSystemInfoSync().windowBottom;
430
+ // #ifdef APP-NVUE
431
+ return 30 + safeBottom;
432
+ // #endif
433
+ // #ifndef APP-NVUE
434
+ return 30;
435
+ // #endif
436
+ }
437
+ },
438
+ watch: {
439
+ pattern: {
440
+ handler(val, oldVal) {
441
+ this.styles = Object.assign({}, this.styles, val);
442
+ },
443
+ deep: true
444
+ }
445
+ },
446
+ created() {
447
+ this.isShow = this.show;
448
+ if (this.top === 0) {
449
+ this.fabShow = true;
450
+ }
451
+ // 初始化样式
452
+ this.styles = Object.assign({}, this.styles, this.pattern);
453
+ },
454
+ methods: {
455
+ _onClick() {
456
+ this.$emit('fabClick');
457
+ if (!this.popMenu) {
458
+ return;
459
+ }
460
+ this.isShow = !this.isShow;
461
+ },
462
+ open() {
463
+ this.isShow = true;
464
+ },
465
+ close() {
466
+ this.isShow = false;
467
+ },
468
+ /**
469
+ * 按钮点击事件
470
+ */
471
+ _onItemClick(index, item) {
472
+ if (!this.isShow) {
473
+ return;
474
+ }
475
+ this.$emit('trigger', {
476
+ index,
477
+ item
478
+ });
479
+ },
480
+ /**
481
+ * 获取 位置信息
482
+ */
483
+ getPosition(types, paramA, paramB) {
484
+ if (types === 0) {
485
+ return this.horizontal === paramA && this.vertical === paramB;
486
+ } else if (types === 1) {
487
+ return this.direction === paramA && this.vertical === paramB;
488
+ } else if (types === 2) {
489
+ return this.direction === paramA && this.horizontal === paramB;
490
+ } else {
491
+ return this.isShow && this.direction === paramA ? this.contentWidth : this.contentWidthMin;
492
+ }
493
+ }
494
+ }
495
+ };
496
+ </script>
497
+ <style>
498
+ @import 'style.css';
499
+ </style>