mali-applet-ui 0.2.21 → 0.2.22

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
- <view class="ml-tabs" :class="[className || '', {'is-sticky': sticky}]">
2
+ <view class="ml-tabs" :class="[className || '']">
3
3
  <view class="ml-tabs-header">
4
4
  <scroll-view scroll-x>
5
5
  <view class="ml-tabs-navs" :class="[itemAlign ? `is-${itemAlign}` : '']">
@@ -21,7 +21,6 @@ export default {
21
21
  name: 'MlTabs',
22
22
  props: {
23
23
  value: [String, Number],
24
- sticky: Boolean,
25
24
  className: String,
26
25
  itemAlign: String,
27
26
  itemWidth: String
@@ -72,14 +71,6 @@ export default {
72
71
  text-align: right;
73
72
  }
74
73
  }
75
- &.is-sticky {
76
- .ml-tabs-header {
77
- position: sticky;
78
- top: 0;
79
- left: 0;
80
- z-index: 33;
81
- }
82
- }
83
74
  .ml-tabs-header {
84
75
  background: #fff;
85
76
  margin-bottom: 20rpx;
@@ -4,7 +4,7 @@
4
4
  <ml-icon :className="prefixIcon"></ml-icon>
5
5
  </view>
6
6
  <view class="ml-text-content">
7
- <slot>{{ content }}</slot>
7
+ <slot>{{ contentText }}</slot>
8
8
  </view>
9
9
  <view v-if="suffixIcon && suffixIcon !== 'none'" class="ml-text-right-icon">
10
10
  <ml-icon :className="suffixIcon"></ml-icon>
@@ -13,11 +13,14 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import XEUtils from 'xe-utils'
17
+
16
18
  export default {
17
19
  name: 'MlText',
18
20
  props: {
19
21
  status: String,
20
22
  content: String,
23
+ max: [Number, String],
21
24
  prefixIcon: String,
22
25
  suffixIcon: String,
23
26
  underline: Boolean,
@@ -25,6 +28,18 @@ export default {
25
28
  redirect: Boolean,
26
29
  className: String
27
30
  },
31
+ computed: {
32
+ contentText () {
33
+ const str = String(this.content || '')
34
+ if (this.max) {
35
+ const maxNum = XEUtils.toNumber(this.max)
36
+ if (maxNum < str.length) {
37
+ return `${str.slice(0, maxNum)}...`
38
+ }
39
+ }
40
+ return str
41
+ }
42
+ },
28
43
  methods: {
29
44
  clickEvent () {
30
45
  this.$emit('click', {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"