mali-applet-ui 0.1.59 → 0.1.60

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-amount-text" :class="[className || '', status ? `status-${status}` : '', {'is-underline': underline}]">
2
+ <view class="ml-amount-text" :class="[className || '', status ? `ss-${status}` : '', {'is-underline': underline}]">
3
3
  <slot name="symbol">
4
4
  <view v-if="symbol" class="amount-flag">¥</view>
5
5
  </slot>
@@ -64,37 +64,37 @@ export default {
64
64
  .amount-unit {
65
65
  padding-left: 5rpx;
66
66
  }
67
- &.status-primary {
67
+ &.ss-primary {
68
68
  color: $uni-color-primary;
69
69
  }
70
- &.status-success {
70
+ &.ss-success {
71
71
  color: $uni-color-success;
72
72
  }
73
- &.status-info {
73
+ &.ss-info {
74
74
  color: #909399;
75
75
  }
76
- &.status-warning {
76
+ &.ss-warning {
77
77
  color: $uni-color-warning;
78
78
  }
79
- &.status-danger {
79
+ &.ss-danger {
80
80
  color: $uni-color-error;
81
81
  }
82
- &.status-gray {
82
+ &.ss-gray {
83
83
  color: $ml-gray-color;
84
84
  }
85
- &.status-blue {
85
+ &.ss-blue {
86
86
  color: $ml-blue-color;
87
87
  }
88
- &.status-green {
88
+ &.ss-green {
89
89
  color: $ml-green-color;
90
90
  }
91
- &.status-pink {
91
+ &.ss-pink {
92
92
  color: $ml-pink-color;
93
93
  }
94
- &.status-orange {
94
+ &.ss-orange {
95
95
  color: $ml-orange-color;
96
96
  }
97
- &.status-purple {
97
+ &.ss-purple {
98
98
  color: $ml-purple-color;
99
99
  }
100
100
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <button class="ml-button" :class="[className || '', `type-${type}`, size ? `size-${size}` : '', status ? `status-${status}` : '', round ? 'is-round' : '']" :open-type="openType" :style="styles" @tap="tapEvent" @click="clickEvent">
2
+ <button class="ml-button" :class="[className || '', `type-${type}`, size ? `size-${size}` : '', status ? `ss-${status}` : '', round ? 'is-round' : '']" :open-type="openType" :style="styles" @tap="tapEvent" @click="clickEvent">
3
3
  <slot>{{ content }}</slot>
4
4
  </button>
5
5
  </template>
@@ -65,37 +65,37 @@ export default {
65
65
  vertical-align: middle;
66
66
  background: transparent;
67
67
  font-size: $uni-font-size-base;
68
- &.status-primary {
68
+ &.ss-primary {
69
69
  color: $uni-color-primary;
70
70
  }
71
- &.status-success {
71
+ &.ss-success {
72
72
  color: $uni-color-success;
73
73
  }
74
- &.status-info {
74
+ &.ss-info {
75
75
  color: #909399;
76
76
  }
77
- &.status-warning {
77
+ &.ss-warning {
78
78
  color: $uni-color-warning;
79
79
  }
80
- &.status-danger {
80
+ &.ss-danger {
81
81
  color: $uni-color-error;
82
82
  }
83
- &.status-gray {
83
+ &.ss-gray {
84
84
  color: $ml-gray-color;
85
85
  }
86
- &.status-blue {
86
+ &.ss-blue {
87
87
  color: $ml-blue-color;
88
88
  }
89
- &.status-green {
89
+ &.ss-green {
90
90
  color: $ml-green-color;
91
91
  }
92
- &.status-pink {
92
+ &.ss-pink {
93
93
  color: $ml-pink-color;
94
94
  }
95
- &.status-orange {
95
+ &.ss-orange {
96
96
  color: $ml-orange-color;
97
97
  }
98
- &.status-purple {
98
+ &.ss-purple {
99
99
  color: $ml-purple-color;
100
100
  }
101
101
  }
@@ -130,52 +130,52 @@ export default {
130
130
  line-height: 60rpx;
131
131
  font-size: 24rpx;
132
132
  }
133
- &.status-primary {
133
+ &.ss-primary {
134
134
  color: #ffffff;
135
135
  background: $uni-color-primary;
136
136
  border-color: $uni-color-primary;
137
137
  }
138
- &.status-success {
138
+ &.ss-success {
139
139
  color: #ffffff;
140
140
  background: $uni-color-success;
141
141
  border-color: $uni-color-success;
142
142
  }
143
- &.status-info {
143
+ &.ss-info {
144
144
  color: #ffffff;
145
145
  background: #909399;
146
146
  border-color: #909399;
147
147
  }
148
- &.status-warning {
148
+ &.ss-warning {
149
149
  color: #ffffff;
150
150
  background: $uni-color-warning;
151
151
  border-color: $uni-color-warning;
152
152
  }
153
- &.status-danger {
153
+ &.ss-danger {
154
154
  color: #ffffff;
155
155
  background: $uni-color-error;
156
156
  border-color: $uni-color-error;
157
157
  }
158
- &.status-gray {
158
+ &.ss-gray {
159
159
  background: $ml-gray-color;
160
160
  border-color: $ml-gray-color;
161
161
  }
162
- &.status-blue {
162
+ &.ss-blue {
163
163
  background: $ml-blue-color;
164
164
  border-color: $ml-blue-color;
165
165
  }
166
- &.status-green {
166
+ &.ss-green {
167
167
  background: $ml-green-color;
168
168
  border-color: $ml-green-color;
169
169
  }
170
- &.status-pink {
170
+ &.ss-pink {
171
171
  background: $ml-pink-color;
172
172
  border-color: $ml-pink-color;
173
173
  }
174
- &.status-orange {
174
+ &.ss-orange {
175
175
  background: $ml-orange-color;
176
176
  border-color: $ml-orange-color;
177
177
  }
178
- &.status-purple {
178
+ &.ss-purple {
179
179
  background: $ml-purple-color;
180
180
  border-color: $ml-purple-color;
181
181
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-chunk-group" :class="[className || '', status ? `status-${status}` : '', align ? `align-${align}` : '', {'is-vertical': vertical, 'is-header': title || $slots.title}]">
2
+ <view class="ml-chunk-group" :class="[className || '', status ? `ss-${status}` : '', align ? `align-${align}` : '', {'is-vertical': vertical, 'is-header': title || $slots.title}]">
3
3
  <view v-if="title || $slots.title" class="ml-chunk-group-title">
4
4
  <slot name="title">
5
5
  <view v-if="prefixIcon" class="ml-chunk-group-left-icon">
@@ -80,67 +80,67 @@ export default {
80
80
  &.align-right {
81
81
  text-align: right;
82
82
  }
83
- &.status-primary {
83
+ &.ss-primary {
84
84
  .ml-chunk-group-content {
85
85
  color: #ffffff;
86
86
  background: $uni-color-primary;
87
87
  }
88
88
  }
89
- &.status-success {
89
+ &.ss-success {
90
90
  .ml-chunk-group-content {
91
91
  color: #ffffff;
92
92
  background: $uni-color-success;
93
93
  }
94
94
  }
95
- &.status-info {
95
+ &.ss-info {
96
96
  .ml-chunk-group-content {
97
97
  color: #ffffff;
98
98
  background: #909399;
99
99
  }
100
100
  }
101
- &.status-warning {
101
+ &.ss-warning {
102
102
  .ml-chunk-group-content {
103
103
  color: #ffffff;
104
104
  background: $uni-color-warning;
105
105
  }
106
106
  }
107
- &.status-danger {
107
+ &.ss-danger {
108
108
  .ml-chunk-group-content {
109
109
  color: #ffffff;
110
110
  background: $uni-color-error;
111
111
  }
112
112
  }
113
- &.status-gray {
113
+ &.ss-gray {
114
114
  .ml-chunk-group-content {
115
115
  color: #ffffff;
116
116
  background: $ml-gray-color;
117
117
  }
118
118
  }
119
- &.status-blue {
119
+ &.ss-blue {
120
120
  .ml-chunk-group-content {
121
121
  color: #ffffff;
122
122
  background: $ml-blue-color;
123
123
  }
124
124
  }
125
- &.status-green {
125
+ &.ss-green {
126
126
  .ml-chunk-group-content {
127
127
  color: #ffffff;
128
128
  background: $ml-green-color;
129
129
  }
130
130
  }
131
- &.status-pink {
131
+ &.ss-pink {
132
132
  .ml-chunk-group-content {
133
133
  color: #ffffff;
134
134
  background: $ml-pink-color;
135
135
  }
136
136
  }
137
- &.status-orange {
137
+ &.ss-orange {
138
138
  .ml-chunk-group-content {
139
139
  color: #ffffff;
140
140
  background: $ml-orange-color;
141
141
  }
142
142
  }
143
- &.status-purple {
143
+ &.ss-purple {
144
144
  .ml-chunk-group-content {
145
145
  color: #ffffff;
146
146
  background: $ml-purple-color;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <text class="ml-dict-type" :class="[className || '', (status || showStatus) && selectStatus ? `status-${selectStatus}` : '', {'is-underline': underline, 'is-border': border, 'is-round': round}]">
2
+ <text class="ml-dict-type" :class="[className || '', (status || showStatus) && selectStatus ? `ss-${selectStatus}` : '', {'is-underline': underline, 'is-border': border, 'is-round': round}]">
3
3
  <slot>{{ selectLabel }}</slot>
4
4
  </text>
5
5
  </template>
@@ -63,68 +63,134 @@ export default {
63
63
  padding: 8rpx 16rpx;
64
64
  border-radius: $ml-border-radius;
65
65
  font-size: 24rpx;
66
- &.status-primary {
66
+ &.ss-primary {
67
67
  color: $uni-color-primary;
68
68
  border: 1px solid $uni-color-primary;
69
69
  }
70
- &.status-success {
70
+ &.ss-success {
71
71
  color: $uni-color-success;
72
72
  border: 1px solid $uni-color-success;
73
73
  }
74
- &.status-info {
74
+ &.ss-info {
75
75
  color: #909399;
76
76
  border: 1px solid #909399;
77
77
  }
78
- &.status-warning {
78
+ &.ss-warning {
79
79
  color: $uni-color-warning;
80
80
  border: 1px solid $uni-color-warning;
81
81
  }
82
- &.status-danger {
82
+ &.ss-danger {
83
83
  color: $uni-color-error;
84
84
  border: 1px solid $uni-color-error;
85
85
  }
86
+ &.ss-gray {
87
+ color: $ml-gray-color;
88
+ border: 1px solid $ml-gray-color;
89
+ }
90
+ &.ss-blue {
91
+ color: $ml-blue-color;
92
+ border: 1px solid $ml-blue-color;
93
+ }
94
+ &.ss-green {
95
+ color: $ml-green-color;
96
+ border: 1px solid $ml-green-color;
97
+ }
98
+ &.ss-pink {
99
+ color: $ml-pink-color;
100
+ border: 1px solid $ml-pink-color;
101
+ }
102
+ &.ss-orange {
103
+ color: $ml-orange-color;
104
+ border: 1px solid $ml-orange-color;
105
+ }
106
+ &.ss-purple {
107
+ color: $ml-purple-color;
108
+ border: 1px solid $ml-purple-color;
109
+ }
86
110
  }
87
111
  &.is-round {
88
112
  padding: 8rpx 16rpx;
89
113
  border-radius: $ml-border-radius;
90
114
  font-size: 24rpx;
91
- &.status-primary {
115
+ &.ss-primary {
92
116
  color: #ffffff;
93
117
  background: $uni-color-primary;
94
118
  }
95
- &.status-success {
119
+ &.ss-success {
96
120
  color: #ffffff;
97
121
  background: $uni-color-success;
98
122
  }
99
- &.status-info {
123
+ &.ss-info {
100
124
  color: #ffffff;
101
125
  background: #909399;
102
126
  }
103
- &.status-warning {
127
+ &.ss-warning {
104
128
  color: #ffffff;
105
129
  background: $uni-color-warning;
106
130
  }
107
- &.status-danger {
131
+ &.ss-danger {
108
132
  color: #ffffff;
109
133
  background: $uni-color-error;
110
134
  }
135
+ &.ss-gray {
136
+ color: #ffffff;
137
+ background: $ml-gray-color;
138
+ }
139
+ &.ss-blue {
140
+ color: #ffffff;
141
+ background: $ml-blue-color;
142
+ }
143
+ &.ss-green {
144
+ color: #ffffff;
145
+ background: $ml-green-color;
146
+ }
147
+ &.ss-pink {
148
+ color: #ffffff;
149
+ background: $ml-pink-color;
150
+ }
151
+ &.ss-orange {
152
+ color: #ffffff;
153
+ background: $ml-orange-color;
154
+ }
155
+ &.ss-purple {
156
+ color: #ffffff;
157
+ background: $ml-purple-color;
158
+ }
111
159
  }
112
160
  &:not(.is-round) {
113
- &.status-primary {
161
+ &.ss-primary {
114
162
  color: $uni-color-primary;
115
163
  }
116
- &.status-success {
164
+ &.ss-success {
117
165
  color: $uni-color-success;
118
166
  }
119
- &.status-info {
167
+ &.ss-info {
120
168
  color: #909399;
121
169
  }
122
- &.status-warning {
170
+ &.ss-warning {
123
171
  color: $uni-color-warning;
124
172
  }
125
- &.status-danger {
173
+ &.ss-danger {
126
174
  color: $uni-color-error;
127
175
  }
176
+ &.ss-gray {
177
+ color: $ml-gray-color;
178
+ }
179
+ &.ss-blue {
180
+ color: $ml-blue-color;
181
+ }
182
+ &.ss-green {
183
+ color: $ml-green-color;
184
+ }
185
+ &.ss-pink {
186
+ color: $ml-pink-color;
187
+ }
188
+ &.ss-orange {
189
+ color: $ml-orange-color;
190
+ }
191
+ &.ss-purple {
192
+ color: $ml-purple-color;
193
+ }
128
194
  }
129
195
  }
130
196
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <text class="ml-icon" :class="[className || '', status ? `status-${status}` : '', name ? `${prefix}${name}` : '', {'is-roll': roll}]" @click="clickEvent"></text>
2
+ <text class="ml-icon" :class="[className || '', status ? `ss-${status}` : '', name ? `${prefix}${name}` : '', {'is-roll': roll}]" @click="clickEvent"></text>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -43,37 +43,37 @@ export default {
43
43
  display: inline-block;
44
44
  animation: rollCircle 1s linear infinite;
45
45
  }
46
- &.status-primary {
46
+ &.ss-primary {
47
47
  color: $uni-color-primary;
48
48
  }
49
- &.status-success {
49
+ &.ss-success {
50
50
  color: $uni-color-success;
51
51
  }
52
- &.status-info {
52
+ &.ss-info {
53
53
  color: #909399;
54
54
  }
55
- &.status-warning {
55
+ &.ss-warning {
56
56
  color: $uni-color-warning;
57
57
  }
58
- &.status-danger {
58
+ &.ss-danger {
59
59
  color: $uni-color-error;
60
60
  }
61
- &.status-gray {
61
+ &.ss-gray {
62
62
  color: $ml-gray-color;
63
63
  }
64
- &.status-blue {
64
+ &.ss-blue {
65
65
  color: $ml-blue-color;
66
66
  }
67
- &.status-green {
67
+ &.ss-green {
68
68
  color: $ml-green-color;
69
69
  }
70
- &.status-pink {
70
+ &.ss-pink {
71
71
  color: $ml-pink-color;
72
72
  }
73
- &.status-orange {
73
+ &.ss-orange {
74
74
  color: $ml-orange-color;
75
75
  }
76
- &.status-purple {
76
+ &.ss-purple {
77
77
  color: $ml-purple-color;
78
78
  }
79
79
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-list-group" :class="[className || '']">
2
+ <view class="ml-list-group" :class="[className || '', type ? `type-${type}` : '']">
3
3
  <view class="ml-list-group-content" :style="contentStyle">
4
4
  <scroll-view scroll-y>
5
5
  <slot></slot>
@@ -20,6 +20,12 @@ export default {
20
20
  name: 'MlListGroup',
21
21
  props: {
22
22
  value: Array,
23
+ checked: {
24
+ type: [Array, Boolean, Number, String],
25
+ default: null
26
+ },
27
+ type: String,
28
+ vertical: Boolean,
23
29
  showPage: Boolean,
24
30
  autoload: Boolean,
25
31
  height: String,
@@ -28,6 +34,11 @@ export default {
28
34
  title: String,
29
35
  className: String
30
36
  },
37
+ provide() {
38
+ return {
39
+ mlListGroup: this
40
+ }
41
+ },
31
42
  inject: {
32
43
  currVM: {
33
44
  from: '$pageVM',
@@ -41,7 +52,9 @@ export default {
41
52
  pageSize: globalStore.loadMore.pageSize,
42
53
  currPage: 1,
43
54
  total: 0
44
- }
55
+ },
56
+ selectValue: null,
57
+ selection: []
45
58
  }
46
59
  },
47
60
  computed: {
@@ -141,6 +154,59 @@ export default {
141
154
  console.error(e)
142
155
  }
143
156
  }
157
+ },
158
+ updateChecked () {
159
+ let rest = null
160
+ if (this.type === 'checkbox') {
161
+ rest = this.selection
162
+ this.$emit('update:checked', rest)
163
+ } else if (this.type === 'radio') {
164
+ rest = this.selectValue
165
+ this.$emit('update:checked', rest)
166
+ }
167
+ this.$emit('change', { checked: rest })
168
+ },
169
+ toggleCheckboxRow (label) {
170
+ const index = this.selection.indexOf(label)
171
+ if (index > -1) {
172
+ this.selection.splice(index, 1)
173
+ } else {
174
+ this.selection.push(label)
175
+ }
176
+ this.updateChecked()
177
+ },
178
+ setCheckboxRow (label, checked) {
179
+ if (checked) {
180
+ if (!this.selection.includes(label)) {
181
+ this.selection.push(label)
182
+ }
183
+ } else {
184
+ const index = this.selection.indexOf(label)
185
+ if (index > -1) {
186
+ this.selection.splice(index, 1)
187
+ }
188
+ }
189
+ this.updateChecked()
190
+ },
191
+ clearCheckboxRow () {
192
+ this.selection = []
193
+ this.updateChecked()
194
+ },
195
+ setRadioRow (label) {
196
+ this.selectValue = label
197
+ this.updateChecked()
198
+ },
199
+ clearRadioRow () {
200
+ this.selectValue = null
201
+ this.updateChecked()
202
+ },
203
+ triggerItemEvent (params) {
204
+ const { value: label } = params
205
+ if (this.type === 'checkbox') {
206
+ this.toggleCheckboxRow(label)
207
+ } else if (this.type === 'radio') {
208
+ this.setRadioRow(label)
209
+ }
144
210
  }
145
211
  }
146
212
  }
@@ -1,11 +1,17 @@
1
1
  <template>
2
- <view class="ml-list-item" :class="className" :style="styles" @click="clickEvent" @tap="tapEvent">
2
+ <view class="ml-list-item" :class="[className || '', itemType ? `type-${itemType}` : '', {'is-vertical': itemVertical}]" :style="styles" @click="clickEvent" @tap="tapEvent">
3
+ <view v-if="itemType === 'checkbox'" class="ml-list-checkbox-icon">
4
+ <ml-checkbox :value="hasCheckedChecked"></ml-checkbox>
5
+ </view>
6
+ <view v-else-if="itemType === 'radio'" class="ml-list-radio-icon">
7
+ <ml-radio :value="hasRadioChecked" :label="value"></ml-radio>
8
+ </view>
3
9
  <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-list-item-left-icon">
4
10
  <ml-icon :className="prefixIcon"></ml-icon>
5
11
  </view>
6
12
  <view class="ml-list-item-content">
7
13
  <slot>
8
- <text>{{ name }}</text>
14
+ <text>{{ content }}</text>
9
15
  </slot>
10
16
  </view>
11
17
  <view v-if="suffixIcon && suffixIcon !== 'none'" class="ml-list-item-right-icon">
@@ -21,9 +27,13 @@ export default {
21
27
  virtualHost: true
22
28
  },
23
29
  props: {
24
- name: String,
25
- vertical: Boolean,
30
+ value: {
31
+ type: [Boolean, Number, String],
32
+ default: null
33
+ },
34
+ content: String,
26
35
  prefixIcon: String,
36
+ vertical: Boolean,
27
37
  suffixIcon: {
28
38
  type: String,
29
39
  default: 'mlicon-arrow-right'
@@ -34,9 +44,10 @@ export default {
34
44
  color: String,
35
45
  className: String
36
46
  },
37
- provide() {
38
- return {
39
- mlListMenu: this
47
+ inject: {
48
+ listGroup: {
49
+ from: 'mlListGroup',
50
+ default: null
40
51
  }
41
52
  },
42
53
  computed: {
@@ -44,6 +55,24 @@ export default {
44
55
  const cr = this.color ? `color:${this.color};` : ''
45
56
  const bgCr = this.backgroundColor ? `background-color:${this.backgroundColor};` : ''
46
57
  return `${bgCr}${cr}`
58
+ },
59
+ hasCheckedChecked () {
60
+ return this.selection.includes(this.value)
61
+ },
62
+ hasRadioChecked () {
63
+ return this.listGroup ? this.listGroup.selectValue : null
64
+ },
65
+ selection () {
66
+ return this.listGroup ? this.listGroup.selection : []
67
+ },
68
+ itemVertical () {
69
+ if (this.vertical) {
70
+ return true
71
+ }
72
+ return this.listGroup ? this.listGroup.vertical : false
73
+ },
74
+ itemType () {
75
+ return this.listGroup ? this.listGroup.type : ''
47
76
  }
48
77
  },
49
78
  methods: {
@@ -51,6 +80,9 @@ export default {
51
80
  this.$emit('click', {})
52
81
  },
53
82
  tapEvent () {
83
+ if (this.listGroup) {
84
+ this.listGroup.triggerItemEvent({ value: this.value })
85
+ }
54
86
  if (this.url) {
55
87
  if (this.redirect) {
56
88
  uni.redirectTo({
@@ -88,6 +120,11 @@ export default {
88
120
  text-overflow: ellipsis;
89
121
  white-space: nowrap;
90
122
  }
123
+ &.is-vertical {
124
+ .ml-list-item-content {
125
+ flex-direction: column;
126
+ }
127
+ }
91
128
  .ml-list-item-left-icon,
92
129
  .ml-list-item-right-icon {
93
130
  width: 60rpx;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-list-menu-group" :class="className">
2
+ <view class="ml-list-menu-group" :class="[className || '', type ? `type-${type}` : '']">
3
3
  <view v-if="title || $slots.title" class="ml-list-menu-group-title">
4
4
  <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-list-menu-group-left-icon">
5
5
  <ml-icon :className="prefixIcon"></ml-icon>
@@ -21,14 +21,86 @@ export default {
21
21
  name: 'MlListMenuGroup',
22
22
  props: {
23
23
  title: String,
24
+ checked: {
25
+ type: [Array, Boolean, Number, String],
26
+ default: null
27
+ },
28
+ type: String,
29
+ vertical: Boolean,
24
30
  prefixIcon: String,
25
31
  height: String,
26
32
  className: String
27
33
  },
34
+ data () {
35
+ return {
36
+ selectValue: null,
37
+ selection: []
38
+ }
39
+ },
40
+ provide() {
41
+ return {
42
+ mlListMenuGroup: this
43
+ }
44
+ },
28
45
  computed: {
29
46
  contentStyle () {
30
47
  return this.height ? `height: ${this.height};` : ''
31
48
  }
49
+ },
50
+ methods: {
51
+ updateChecked () {
52
+ let rest = null
53
+ if (this.type === 'checkbox') {
54
+ rest = this.selection
55
+ this.$emit('update:checked', rest)
56
+ } else if (this.type === 'radio') {
57
+ rest = this.selectValue
58
+ this.$emit('update:checked', rest)
59
+ }
60
+ this.$emit('change', { checked: rest })
61
+ },
62
+ toggleCheckboxRow (label) {
63
+ const index = this.selection.indexOf(label)
64
+ if (index > -1) {
65
+ this.selection.splice(index, 1)
66
+ } else {
67
+ this.selection.push(label)
68
+ }
69
+ this.updateChecked()
70
+ },
71
+ setCheckboxRow (label, checked) {
72
+ if (checked) {
73
+ if (!this.selection.includes(label)) {
74
+ this.selection.push(label)
75
+ }
76
+ } else {
77
+ const index = this.selection.indexOf(label)
78
+ if (index > -1) {
79
+ this.selection.splice(index, 1)
80
+ }
81
+ }
82
+ this.updateChecked()
83
+ },
84
+ clearCheckboxRow () {
85
+ this.selection = []
86
+ this.updateChecked()
87
+ },
88
+ setRadioRow (label) {
89
+ this.selectValue = label
90
+ this.updateChecked()
91
+ },
92
+ clearRadioRow () {
93
+ this.selectValue = null
94
+ this.updateChecked()
95
+ },
96
+ triggerItemEvent (params) {
97
+ const { value: label } = params
98
+ if (this.type === 'checkbox') {
99
+ this.toggleCheckboxRow(label)
100
+ } else if (this.type === 'radio') {
101
+ this.setRadioRow(label)
102
+ }
103
+ }
32
104
  }
33
105
  }
34
106
  </script>
@@ -1,15 +1,21 @@
1
1
  <template>
2
- <view class="ml-list-menu-item" :class="[className || '', {'is-vertical': itemVertical}]" @click="clickEvent" @tap="tapEvent">
2
+ <view class="ml-list-menu-item" :class="[className || '', itemType ? `type-${itemType}` : '', {'is-vertical': itemVertical}]" @click="clickEvent" @tap="tapEvent">
3
+ <view v-if="itemType === 'checkbox'" class="ml-list-checkbox-icon">
4
+ <ml-checkbox :value="hasCheckedChecked"></ml-checkbox>
5
+ </view>
6
+ <view v-else-if="itemType === 'radio'" class="ml-list-radio-icon">
7
+ <ml-radio :value="hasRadioChecked" :label="value"></ml-radio>
8
+ </view>
3
9
  <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-list-menu-item-left-icon">
4
10
  <ml-icon :className="prefixIcon"></ml-icon>
5
11
  </view>
6
12
  <view class="ml-list-menu-item-content">
7
13
  <slot>
8
- <text>{{ name }}</text>
14
+ <text>{{ content || name }}</text>
9
15
  </slot>
10
16
  </view>
11
17
  <view v-if="showDot && dotNum" class="ml-list-menu-item-dot">
12
- <text class="ml-list-menu-item-dot-num" :class="[dotStatus ? `status-${dotStatus}` : '']">{{ getDotNum(dotNum) }}</text>
18
+ <text class="ml-list-menu-item-dot-num" :class="[dotStatus ? `s-${dotStatus}` : '']">{{ getDotNum(dotNum) }}</text>
13
19
  </view>
14
20
  <view v-if="suffixIcon && suffixIcon !== 'none'" class="ml-list-menu-item-right-icon">
15
21
  <ml-icon :className="suffixIcon"></ml-icon>
@@ -24,7 +30,12 @@ export default {
24
30
  virtualHost: true
25
31
  },
26
32
  props: {
33
+ value: {
34
+ type: [Boolean, Number, String],
35
+ default: null
36
+ },
27
37
  name: String,
38
+ content: String,
28
39
  vertical: Boolean,
29
40
  prefixIcon: String,
30
41
  suffixIcon: {
@@ -39,17 +50,29 @@ export default {
39
50
  dotNum: [String, Number]
40
51
  },
41
52
  inject: {
42
- listMenu: {
43
- from: 'mlListMenu',
53
+ listMenuGroup: {
54
+ from: 'mlListMenuGroup',
44
55
  default: null
45
56
  }
46
57
  },
47
58
  computed: {
59
+ hasCheckedChecked () {
60
+ return this.selection.includes(this.value)
61
+ },
62
+ hasRadioChecked () {
63
+ return this.listMenuGroup ? this.listMenuGroup.selectValue : null
64
+ },
65
+ selection () {
66
+ return this.listMenuGroup ? this.listMenuGroup.selection : []
67
+ },
48
68
  itemVertical () {
49
69
  if (this.vertical) {
50
70
  return true
51
71
  }
52
- return this.listMenu ? this.listMenu.vertical : false
72
+ return this.listMenuGroup ? this.listMenuGroup.vertical : false
73
+ },
74
+ itemType () {
75
+ return this.listMenuGroup ? this.listMenuGroup.type : ''
53
76
  }
54
77
  },
55
78
  methods: {
@@ -60,6 +83,9 @@ export default {
60
83
  this.$emit('click', {})
61
84
  },
62
85
  tapEvent () {
86
+ if (this.listMenuGroup) {
87
+ this.listMenuGroup.triggerItemEvent({ value: this.value })
88
+ }
63
89
  if (this.url) {
64
90
  if (this.redirect) {
65
91
  uni.redirectTo({
@@ -117,37 +143,37 @@ export default {
117
143
  text-align: center;
118
144
  font-size: 22rpx;
119
145
  line-height: 40rpx;
120
- &.status-primary {
146
+ &.s-primary {
121
147
  background-color: $uni-color-primary;
122
148
  }
123
- &.status-success {
149
+ &.s-success {
124
150
  background-color: $uni-color-success;
125
151
  }
126
- &.status-info {
152
+ &.s-info {
127
153
  background-color: #909399;
128
154
  }
129
- &.status-warning {
155
+ &.s-warning {
130
156
  background-color: $uni-color-warning;
131
157
  }
132
- &.status-danger {
158
+ &.s-danger {
133
159
  background-color: $uni-color-error;
134
160
  }
135
- &.status-gray {
161
+ &.s-gray {
136
162
  background-color: $ml-gray-color;
137
163
  }
138
- &.status-blue {
164
+ &.s-blue {
139
165
  background-color: $ml-blue-color;
140
166
  }
141
- &.status-green {
167
+ &.s-green {
142
168
  background-color: $ml-green-color;
143
169
  }
144
- &.status-pink {
170
+ &.s-pink {
145
171
  background-color: $ml-pink-color;
146
172
  }
147
- &.status-orange {
173
+ &.s-orange {
148
174
  background-color: $ml-orange-color;
149
175
  }
150
- &.status-purple {
176
+ &.s-purple {
151
177
  background-color: $ml-purple-color;
152
178
  }
153
179
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-row" :class="[className || '', status ? `status-${status}` : '', {'is-vertical': vertical}]" @click="clickEvent">
2
+ <view class="ml-row" :class="[className || '', status ? `ss-${status}` : '', {'is-vertical': vertical}]" @click="clickEvent">
3
3
  <slot></slot>
4
4
  </view>
5
5
  </template>
@@ -31,37 +31,37 @@ export default {
31
31
  &.is-vertical {
32
32
  flex-direction: column;
33
33
  }
34
- &.status-primary {
34
+ &.ss-primary {
35
35
  color: $uni-color-primary;
36
36
  }
37
- &.status-success {
37
+ &.ss-success {
38
38
  color: $uni-color-success;
39
39
  }
40
- &.status-info {
40
+ &.ss-info {
41
41
  color: #909399;
42
42
  }
43
- &.status-warning {
43
+ &.ss-warning {
44
44
  color: $uni-color-warning;
45
45
  }
46
- &.status-danger {
46
+ &.ss-danger {
47
47
  color: $uni-color-error;
48
48
  }
49
- &.status-gray {
49
+ &.ss-gray {
50
50
  color: $ml-gray-color;
51
51
  }
52
- &.status-blue {
52
+ &.ss-blue {
53
53
  color: $ml-blue-color;
54
54
  }
55
- &.status-green {
55
+ &.ss-green {
56
56
  color: $ml-green-color;
57
57
  }
58
- &.status-pink {
58
+ &.ss-pink {
59
59
  color: $ml-pink-color;
60
60
  }
61
- &.status-orange {
61
+ &.ss-orange {
62
62
  color: $ml-orange-color;
63
63
  }
64
- &.status-purple {
64
+ &.ss-purple {
65
65
  color: $ml-purple-color;
66
66
  }
67
67
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-status-tag" :class="[className, status ? `status-${status}` : '']" :style="styles">
2
+ <view class="ml-status-tag" :class="[className, status ? `ss-${status}` : '']" :style="styles">
3
3
  <slot>
4
4
  <text>{{ content }}</text>
5
5
  </slot>
@@ -33,37 +33,37 @@ export default {
33
33
  padding: 8rpx 16rpx;
34
34
  border-radius: $ml-border-radius;
35
35
  font-size: 24rpx;
36
- &.status-primary {
36
+ &.ss-primary {
37
37
  background: $uni-color-primary;
38
38
  }
39
- &.status-success {
39
+ &.ss-success {
40
40
  background: $uni-color-success;
41
41
  }
42
- &.status-info {
42
+ &.ss-info {
43
43
  background: #909399;
44
44
  }
45
- &.status-warning {
45
+ &.ss-warning {
46
46
  background: $uni-color-warning;
47
47
  }
48
- &.status-danger {
48
+ &.ss-danger {
49
49
  background: $uni-color-error;
50
50
  }
51
- &.status-gray {
51
+ &.ss-gray {
52
52
  background: $ml-gray-color;
53
53
  }
54
- &.status-blue {
54
+ &.ss-blue {
55
55
  background: $ml-blue-color;
56
56
  }
57
- &.status-green {
57
+ &.ss-green {
58
58
  background: $ml-green-color;
59
59
  }
60
- &.status-pink {
60
+ &.ss-pink {
61
61
  background: $ml-pink-color;
62
62
  }
63
- &.status-orange {
63
+ &.ss-orange {
64
64
  background: $ml-orange-color;
65
65
  }
66
- &.status-purple {
66
+ &.ss-purple {
67
67
  background: $ml-purple-color;
68
68
  }
69
69
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-text" :class="[className || '', status ? `status-${status}` : '', {'is-underline': underline}]" @click="clickEvent" @tap="tapEvent">
2
+ <view class="ml-text" :class="[className || '', status ? `ss-${status}` : '', {'is-underline': underline}]" @click="clickEvent" @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>
@@ -54,37 +54,37 @@ export default {
54
54
  &.is-underline {
55
55
  text-decoration: underline;
56
56
  }
57
- &.status-primary {
57
+ &.ss-primary {
58
58
  color: $uni-color-primary;
59
59
  }
60
- &.status-success {
60
+ &.ss-success {
61
61
  color: $uni-color-success;
62
62
  }
63
- &.status-info {
63
+ &.ss-info {
64
64
  color: #909399;
65
65
  }
66
- &.status-warning {
66
+ &.ss-warning {
67
67
  color: $uni-color-warning;
68
68
  }
69
- &.status-danger {
69
+ &.ss-danger {
70
70
  color: $uni-color-error;
71
71
  }
72
- &.status-gray {
72
+ &.ss-gray {
73
73
  color: $ml-gray-color;
74
74
  }
75
- &.status-blue {
75
+ &.ss-blue {
76
76
  color: $ml-blue-color;
77
77
  }
78
- &.status-green {
78
+ &.ss-green {
79
79
  color: $ml-green-color;
80
80
  }
81
- &.status-pink {
81
+ &.ss-pink {
82
82
  color: $ml-pink-color;
83
83
  }
84
- &.status-orange {
84
+ &.ss-orange {
85
85
  color: $ml-orange-color;
86
86
  }
87
- &.status-purple {
87
+ &.ss-purple {
88
88
  color: $ml-purple-color;
89
89
  }
90
90
  .ml-text-left-icon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",