mali-applet-ui 1.1.67 → 1.1.68

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <text class="ml-icon" :class="[className || '', size ? `size-${size}` : '', status ? `ss-${status}` : '', name ? `${prefix}${name}` : '', {'is-roll': roll}]" :style="styles" @click="clickEvent" @tap="tapEvent"></text>
2
+ <text class="ml-icon" :class="[className || '', size ? `size-${size}` : '', status ? `ss-${status}` : '', name ? `${prefix}${name}` : '', {'is-roll': roll}]" :style="styles" @tap="clickEvent"></text>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -31,11 +31,9 @@ export default {
31
31
  }
32
32
  },
33
33
  methods: {
34
- clickEvent (e) {
35
- },
36
- tapEvent () {
37
- this.$emit('tap', {})
38
- this.$emit('click', {})
34
+ clickEvent (evnt) {
35
+ this.$emit('tap', { $event: evnt })
36
+ this.$emit('click', { $event: evnt })
39
37
  }
40
38
  }
41
39
  }
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <view class="ml-tag" :class="[className || '', status ? `ss-${status}` : '', {'is-round': round}]" @tap="clickEvent">
3
+ <view class="ml-tag-content">
4
+ <slot>{{ content }}</slot>
5
+ </view>
6
+ <view class="ml-tag-close-warpper" v-if="closable" @tap="closeEvent">
7
+ <ml-icon class="ml-tag-close-btn" name="close"></ml-icon>
8
+ </view>
9
+ </view>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: 'MlTag',
15
+ options: {
16
+ virtualHost: true
17
+ },
18
+ props: {
19
+ status: String,
20
+ round: Boolean,
21
+ closable: Boolean,
22
+ content: String,
23
+ className: String
24
+ },
25
+ methods: {
26
+ closeEvent (evnt) {
27
+ evnt.stopPropagation()
28
+ this.$emit('close', { $event: evnt })
29
+ },
30
+ clickEvent (evnt) {
31
+ this.$emit('tap', { $event: evnt })
32
+ this.$emit('click', { $event: evnt })
33
+ }
34
+ }
35
+ }
36
+ </script>
37
+
38
+ <style lang="scss">
39
+ .ml-tag {
40
+ display: inline-flex;
41
+ padding: 4rpx 16rpx;
42
+ border: 2rpx solid #e8e8e8;
43
+ margin: 0 8rpx;
44
+ border-radius: 8rpx;
45
+ font-size: 24rpx;
46
+ &.is-round {
47
+ border-radius: $ml-border-radius;
48
+ }
49
+ &.ss-primary {
50
+ color: #fff;
51
+ background: $ml-theme-primary-color;
52
+ }
53
+ &.ss-success {
54
+ color: #fff;
55
+ background: $ml-theme-success-color;
56
+ }
57
+ &.ss-info {
58
+ background: #909399;
59
+ }
60
+ &.ss-warning {
61
+ color: #fff;
62
+ background: $ml-theme-warning-color;
63
+ }
64
+ &.ss-danger {
65
+ color: #fff;
66
+ background: $ml-theme-error-color;
67
+ }
68
+ &.ss-gray {
69
+ background: $ml-gray-color;
70
+ }
71
+ &.ss-blue {
72
+ color: #fff;
73
+ background: $ml-blue-color;
74
+ }
75
+ &.ss-green {
76
+ color: #fff;
77
+ background: $ml-green-color;
78
+ }
79
+ &.ss-pink {
80
+ color: #fff;
81
+ background: $ml-pink-color;
82
+ }
83
+ &.ss-red {
84
+ color: #fff;
85
+ background: $ml-red-color;
86
+ }
87
+ &.ss-orange {
88
+ color: #fff;
89
+ background: $ml-orange-color;
90
+ }
91
+ &.ss-purple {
92
+ color: #fff;
93
+ background: $ml-purple-color;
94
+ }
95
+ &.ss-white {
96
+ background: $ml-white-color;
97
+ }
98
+ .ml-tag-close-warpper {
99
+ flex-shrink: 0;
100
+ padding: 0 8rpx;
101
+ cursor: pointer;
102
+ }
103
+ .ml-tag-close-btn {
104
+ padding: 4rpx;
105
+ font-size: 24rpx;
106
+ &:hover {
107
+ color: #fff;
108
+ background: #909399;
109
+ border-radius: 50%;
110
+ }
111
+ }
112
+ }
113
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-text" :class="[className || '', status ? `ss-${status}` : '', {'is-underline': underline}]" @click="clickEvent" @tap="tapEvent">
2
+ <view class="ml-text" :class="[className || '', status ? `ss-${status}` : '', {'is-underline': underline}]" @tap="tapEvent">
3
3
  <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-text-left-icon">
4
4
  <ml-icon :className="prefixIcon"></ml-icon>
5
5
  </view>
@@ -44,9 +44,7 @@ export default {
44
44
  }
45
45
  },
46
46
  methods: {
47
- clickEvent () {
48
- },
49
- tapEvent () {
47
+ tapEvent (evnt) {
50
48
  if (this.url) {
51
49
  if (this.redirect) {
52
50
  uni.redirectTo({
@@ -58,8 +56,8 @@ export default {
58
56
  })
59
57
  }
60
58
  }
61
- this.$emit('tap', {})
62
- this.$emit('click', {})
59
+ this.$emit('tap', { $event: evnt })
60
+ this.$emit('click', { $event: evnt })
63
61
  }
64
62
  }
65
63
  }
@@ -8,7 +8,7 @@
8
8
  <ml-icon name="close" />
9
9
  </view>
10
10
  </view>
11
- <template v-if="!isFromReadonly && fileList.length < limit">
11
+ <template v-if="!isFromReadonly && !isLimit">
12
12
  <view v-if="hasForm" class="ml-upload-image-form-add-btn" @tap="chooseEvent">
13
13
  <ml-icon v-if="loading" name="loading" roll />
14
14
  <ml-icon v-else name="add-circle" />
@@ -26,7 +26,7 @@
26
26
  </view>
27
27
  <!-- 上传文件 -->
28
28
  <view v-else class="ml-upload-file-list">
29
- <template v-if="!isFromReadonly && fileList.length < limit">
29
+ <template v-if="!isFromReadonly && !isLimit">
30
30
  <view v-if="hasForm" class="ml-upload-file-form-add-btn" @tap="chooseEvent">
31
31
  <ml-icon v-if="loading" name="loading" roll />
32
32
  <ml-icon v-else name="add-circle" />
@@ -38,7 +38,7 @@
38
38
  <ml-icon v-else name="add" />
39
39
  </text>
40
40
  <text v-if="loading">上传中...</text>
41
- <text v-else>添加文件</text>
41
+ <text v-else>{{ uploadButtonText || '选择文件' }}</text>
42
42
  </view>
43
43
  </view>
44
44
  </template>
@@ -183,15 +183,18 @@ export default {
183
183
  type: Boolean,
184
184
  default: false
185
185
  },
186
- limit: {
186
+ limit: Number,
187
+ limitCount: Number,
188
+ limitSize: {
187
189
  type: Number,
188
- default: 9
190
+ default: 20480
189
191
  },
190
192
  className: String,
191
193
  mediatype: {
192
194
  type: String,
193
195
  default: 'all'
194
196
  },
197
+ uploadButtonText: String,
195
198
  params: {
196
199
  type: Object,
197
200
  default: () => ({})
@@ -238,6 +241,15 @@ export default {
238
241
  hasForm () {
239
242
  return !!this.form
240
243
  },
244
+ limitFileLen () {
245
+ return this.limitCount || this.limit || 9
246
+ },
247
+ isLimit () {
248
+ if (this.multiple) {
249
+ return this.fileList.length >= this.limitFileLen
250
+ }
251
+ return this.fileList.length >= 1
252
+ },
241
253
  isFromReadonly () {
242
254
  if (XEUtils.isBoolean(this.readonly)) {
243
255
  return this.readonly
@@ -510,7 +522,7 @@ export default {
510
522
  chooseMethod({
511
523
  sizeType: this.sizeType,
512
524
  sourceType: this.sourceType,
513
- count: this.limit - this.fileList.length,
525
+ count: this.limitFileLen - this.fileList.length,
514
526
  quality: this.imageQuality
515
527
  }).then(res => {
516
528
  const { tempFiles } = res
@@ -543,7 +555,7 @@ export default {
543
555
  }
544
556
  })
545
557
  ).then(list => {
546
- this.fileList = [...this.fileList, ...list].slice(-this.limit)
558
+ this.fileList = [...this.fileList, ...list].slice(-this.limitFileLen)
547
559
  this.isModelUpdate = true
548
560
  this.updateModel()
549
561
  this.loading = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.67",
3
+ "version": "1.1.68",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",