mali-applet-ui 1.0.77 → 1.0.78

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.
@@ -137,24 +137,27 @@ export default {
137
137
  this.inpVal = eqEmptyNull(value) ? '' : XEUtils.toFixed(XEUtils.toNumber(value), 2)
138
138
  },
139
139
  checkValue () {
140
- // 如果是空值,则不处理
141
- if (eqEmptyNull(this.inpVal) && eqEmptyNull(this.value)) {
142
- return { status: false, value: this.inpVal }
143
- }
144
140
  const numVal = XEUtils.toNumber(this.inpVal)
145
141
  if (this.minNum !== null && (numVal < this.minNum)) {
146
- this.$emit('input', this.minNum)
147
142
  this.updateModel = true
143
+ this.updateValue(this.minNum)
144
+ this.$emit('input', this.minNum)
148
145
  return { status: false, value: this.minNum }
149
146
  }
150
147
  if (this.maxNum !== null && (numVal > this.maxNum)) {
151
- this.$emit('input', this.maxNum)
152
148
  this.updateModel = true
149
+ this.updateValue(this.maxNum)
150
+ this.$emit('input', this.maxNum)
153
151
  return { status: false, value: this.maxNum }
154
152
  }
153
+ // 如果是空值,则不处理
154
+ if (eqEmptyNull(this.inpVal) && eqEmptyNull(this.value)) {
155
+ return { status: false, value: this.inpVal }
156
+ }
155
157
  const val = XEUtils.floor(numVal, 2)
156
158
  if (`${val}` !== `${this.value}`) {
157
159
  this.updateModel = true
160
+ this.updateValue(val)
158
161
  this.$emit('input', val)
159
162
  return { status: false, value: val }
160
163
  }
@@ -126,34 +126,39 @@ export default {
126
126
  this.inpVal = eqEmptyNull(value) ? '' : String(XEUtils.toNumber(value))
127
127
  },
128
128
  checkValue () {
129
- // 如果是空值,则不处理
130
- if (eqEmptyNull(this.inpVal) && eqEmptyNull(this.value)) {
131
- return { status: true, value: this.inpVal }
132
- }
133
129
  const numVal = XEUtils.toNumber(XEUtils.toValueString(this.inpVal).slice(0, this.maxLength))
134
130
  if (this.minNum !== null && (numVal < this.minNum)) {
135
131
  this.updateModel = true
132
+ this.inpVal = this.minNum
136
133
  this.$emit('input', this.minNum)
137
134
  return { status: false, value: this.minNum }
138
135
  }
139
136
  if (this.maxNum !== null && (numVal > this.maxNum)) {
140
137
  this.updateModel = true
138
+ this.inpVal = this.maxNum
141
139
  this.$emit('input', this.maxNum)
142
140
  return { status: false, value: this.maxNum }
143
141
  }
142
+ // 如果是空值,则不处理
143
+ if (eqEmptyNull(this.inpVal) && eqEmptyNull(this.value)) {
144
+ return { status: true, value: this.inpVal }
145
+ }
144
146
  if (this.type === 'integer' && !/^-?[0-9]+$/.test(numVal)) {
145
147
  const value = XEUtils.toInteger(numVal)
146
148
  this.updateModel = true
149
+ this.inpVal = value
147
150
  this.$emit('input', value)
148
151
  return { status: false, value: value }
149
152
  }
150
153
  if (`${numVal}` !== this.inpVal) {
151
154
  this.updateModel = true
155
+ this.inpVal = numVal
152
156
  this.$emit('input', numVal)
153
157
  return { status: false, value: numVal }
154
158
  }
155
159
  if (`${numVal}` !== `${this.value}`) {
156
160
  this.updateModel = true
161
+ this.inpVal = numVal
157
162
  this.$emit('input', numVal)
158
163
  return { status: false, value: numVal }
159
164
  }
@@ -272,6 +277,7 @@ export default {
272
277
  width: 80rpx;
273
278
  border: 1px solid #e5e5e5;
274
279
  font-size: 36rpx;
280
+ padding: 0 16rpx;
275
281
  background: #F2F2F6;
276
282
  }
277
283
  .ml-number-input-minus-btn {
@@ -12,14 +12,21 @@
12
12
  </slot>
13
13
  </view>
14
14
  <ml-fixed-footer>
15
- <ml-button>上一页</ml-button>
15
+ <ml-button :disabled="pageVO.currPage <= 1" @click="prevPage()">上一页</ml-button>
16
16
  <ml-button @click="openPageEvent">{{ pageVO.currPage }}/{{ pageCount }}</ml-button>
17
- <ml-button>下一页</ml-button>
17
+ <ml-button :disabled="pageVO.currPage >= pageCount" @click="nextPage()">下一页</ml-button>
18
18
  </ml-fixed-footer>
19
19
 
20
- <ml-modal v-model="showPopup" title="跳往页码" showConfirmButton showCancelButton>
21
- <view>自定义内容</view>
22
- <ml-number-input v-model="val3" border controls />
20
+ <ml-modal v-model="showPopup" title="跳往页码" height="200rpx" showConfirmButton showCancelButton @confirm="confirmEvent">
21
+ <view class="ml-pager-jump-popup-warpper">
22
+ <view class="ml-pager-jump-popup-left">
23
+ <ml-number-input v-model="tempCurrPage" :min="1" :max="pageCount" border />
24
+ </view>
25
+ <view class="ml-pager-jump-popup-content">/</view>
26
+ <view class="ml-pager-jump-popup-right">
27
+ <view class="ml-pager-jump-popup-count">{{ pageCount }}</view>
28
+ </view>
29
+ </view>
23
30
  </ml-modal>
24
31
  </view>
25
32
  </template>
@@ -53,6 +60,7 @@ export default {
53
60
  currPage: 1,
54
61
  total: 0
55
62
  },
63
+ tempCurrPage: 0,
56
64
  showPopup: false,
57
65
  emptyUrl: '',
58
66
  emptyText: '',
@@ -61,7 +69,10 @@ export default {
61
69
  },
62
70
  computed: {
63
71
  pageCount () {
64
- return Math.floor(this.pageVO.pageSize / this.pageVO.total) + 1
72
+ if (this.pageVO.total) {
73
+ return XEUtils.ceil(this.pageVO.total / this.pageVO.pageSize)
74
+ }
75
+ return 1
65
76
  },
66
77
  loadStatus () {
67
78
  if (this.loading) {
@@ -170,7 +181,27 @@ export default {
170
181
  })
171
182
  },
172
183
  openPageEvent () {
173
-
184
+ this.tempCurrPage = this.pageVO.currPage
185
+ this.showPopup = true
186
+ },
187
+ confirmEvent () {
188
+ this.showPopup = false
189
+ if (String(this.pageVO.currPage) !== String(this.tempCurrPage)) {
190
+ this.pageVO.currPage = XEUtils.toNumber(this.tempCurrPage)
191
+ this.load()
192
+ }
193
+ },
194
+ prevPage () {
195
+ if (this.pageVO.currPage > 1) {
196
+ this.pageVO.currPage--
197
+ this.load()
198
+ }
199
+ },
200
+ nextPage () {
201
+ if (this.pageVO.currPage < this.pageCount) {
202
+ this.pageVO.currPage++
203
+ this.load()
204
+ }
174
205
  }
175
206
  }
176
207
  }
@@ -187,4 +218,27 @@ export default {
187
218
  text-align: center;
188
219
  }
189
220
  }
221
+ .ml-pager-jump-popup-warpper {
222
+ display: flex;
223
+ flex-direction: row;
224
+ align-items: center;
225
+ padding: 0 40rpx;
226
+ .ml-pager-jump-popup-left,
227
+ .ml-pager-jump-popup-right {
228
+ flex-grow: 1;
229
+ width: 40%;
230
+ text-align: center;
231
+ }
232
+ .ml-pager-jump-popup-content {
233
+ flex-shrink: 0;
234
+ text-align: center;
235
+ width: 80rpx;
236
+ }
237
+ .ml-pager-jump-popup-count {
238
+ height: 70rpx;
239
+ line-height: 70rpx;
240
+ border-radius: $ml-border-radius;
241
+ background: #F2F2F6;
242
+ }
243
+ }
190
244
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",