mali-applet-ui 1.0.37 → 1.0.38

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.
@@ -9,7 +9,9 @@ export default {
9
9
  name: 'MlTabContainer',
10
10
  props: {
11
11
  value: [String, Number],
12
- className: String
12
+ className: String,
13
+ itemAlign: String,
14
+ itemWidth: String
13
15
  },
14
16
  provide () {
15
17
  return {
@@ -20,6 +22,13 @@ export default {
20
22
  return {
21
23
  tabList: []
22
24
  }
25
+ },
26
+ methods: {
27
+ changeEvent (item) {
28
+ const value = item.name
29
+ this.$emit('input', value)
30
+ this.$emit('change', { value })
31
+ }
23
32
  }
24
33
  }
25
34
  </script>
@@ -27,6 +36,7 @@ export default {
27
36
  <style lang="scss">
28
37
  .ml-tab-container {
29
38
  position: relative;
39
+ flex-grow: 1;
30
40
  font-size: $ml-base-font-size;
31
41
  overflow: auto;
32
42
  }
@@ -0,0 +1,175 @@
1
+ <template>
2
+ <view class="ml-tab-container-navs" :class="[className || '']">
3
+ <view class="ml-tabs-header">
4
+ <scroll-view scroll-x>
5
+ <view class="ml-tabs-navs" :class="[itemAlign ? `is-${itemAlign}` : '']">
6
+ <view class="ml-tabs-nav-item" v-for="(item, index) in tabList" :key="index" :class="{'is-active': activeTab === item.name}" :style="item.width ? `width:${item.itemWidth};` : itemStyles" @tap="changeEvent(item)">
7
+ <view class="ml-tabs-nav-title">{{ item.title }}</view>
8
+ <view v-if="item.showDot && item.dotNum > 0" class="ml-tabs-nav-title-dot-num" :class="[item.dotStatus ? `s-${item.dotStatus}` : '']">{{ getDotNum(item.dotNum) }}</view>
9
+ <view v-else-if="item.showDot" class="ml-tabs-nav-title-dot" :class="[item.dotStatus ? `s-${item.dotStatus}` : '']"></view>
10
+ </view>
11
+ </view>
12
+ </scroll-view>
13
+ </view>
14
+ </view>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ name: 'MlTabContainerNavs',
20
+ props: {
21
+ className: String
22
+ },
23
+ inject: {
24
+ tabs: {
25
+ from: 'mlTabs',
26
+ default: null
27
+ }
28
+ },
29
+ computed: {
30
+ itemStyles () {
31
+ return this.itemWidth ? `width:${this.itemWidth};` : ''
32
+ },
33
+ activeTab () {
34
+ if (this.tabs) {
35
+ return this.tabs.value
36
+ }
37
+ return null
38
+ },
39
+ tabList () {
40
+ if (this.tabs) {
41
+ return this.tabs.tabList
42
+ }
43
+ return []
44
+ },
45
+ itemAlign () {
46
+ if (this.tabs) {
47
+ return this.tabs.itemAlign
48
+ }
49
+ return ''
50
+ },
51
+ itemWidth () {
52
+ if (this.tabs) {
53
+ return this.tabs.itemWidth
54
+ }
55
+ return ''
56
+ }
57
+ },
58
+ methods: {
59
+ getDotNum (num) {
60
+ return num > 99 ? '99+' : num
61
+ },
62
+ changeEvent (item) {
63
+ if (this.tabs) {
64
+ this.tabs.changeEvent(item)
65
+ }
66
+ }
67
+ }
68
+ }
69
+ </script>
70
+
71
+ <style lang="scss">
72
+ .ml-tab-container-navs {
73
+ display: flex;
74
+ flex-direction: column;
75
+ font-size: $ml-base-font-size;
76
+ .ml-tabs-navs {
77
+ flex-shrink: 0;
78
+ white-space: nowrap;
79
+ &.is-left {
80
+ text-align: left;
81
+ }
82
+ &.is-center {
83
+ text-align: center;
84
+ }
85
+ &.is-right {
86
+ text-align: right;
87
+ }
88
+ }
89
+ .ml-tabs-header {
90
+ background: #fff;
91
+ padding-bottom: 10rpx;
92
+ }
93
+ .ml-tabs-content {
94
+ display: flex;
95
+ flex-direction: column;
96
+ flex-grow: 1;
97
+ overflow: auto;
98
+ }
99
+ .ml-tabs-nav-item {
100
+ position: relative;
101
+ display: inline-block;
102
+ padding: 10rpx 10rpx 0 10rpx;
103
+ text-align: center;
104
+ .ml-tabs-nav-title {
105
+ position: relative;
106
+ padding: 10rpx 10rpx;
107
+ }
108
+ &.is-active {
109
+ .ml-tabs-nav-title {
110
+ color: $uni-color-primary;
111
+ &::before {
112
+ content: "";
113
+ position: absolute;
114
+ bottom: 0;
115
+ left: 50%;
116
+ transform: translateX(-50%);
117
+ width: 100%;
118
+ min-width: 40rpx;
119
+ max-width: 60rpx;
120
+ height: 5rpx;
121
+ background: $uni-color-primary;
122
+ }
123
+ }
124
+ }
125
+ }
126
+ .ml-tabs-nav-title-dot-num {
127
+ position: absolute;
128
+ top: 0;
129
+ right: 0;
130
+ background-color: #f56c6c;
131
+ color: #fff;
132
+ border-radius: 40rpx;
133
+ padding: 0 10rpx;
134
+ vertical-align: middle;
135
+ display: inline-block;
136
+ min-width: 40rpx;
137
+ text-align: center;
138
+ font-size: 22rpx;
139
+ line-height: 40rpx;
140
+ &.s-primary {
141
+ background-color: $uni-color-primary;
142
+ }
143
+ &.s-success {
144
+ background-color: $uni-color-success;
145
+ }
146
+ &.s-info {
147
+ background-color: #909399;
148
+ }
149
+ &.s-warning {
150
+ background-color: $uni-color-warning;
151
+ }
152
+ &.s-danger {
153
+ background-color: $uni-color-error;
154
+ }
155
+ &.s-gray {
156
+ background-color: $ml-gray-color;
157
+ }
158
+ &.s-blue {
159
+ background-color: $ml-blue-color;
160
+ }
161
+ &.s-green {
162
+ background-color: $ml-green-color;
163
+ }
164
+ &.s-pink {
165
+ background-color: $ml-pink-color;
166
+ }
167
+ &.s-orange {
168
+ background-color: $ml-orange-color;
169
+ }
170
+ &.s-purple {
171
+ background-color: $ml-purple-color;
172
+ }
173
+ }
174
+ }
175
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",