mali-applet-ui 0.2.79 → 0.2.80

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.
@@ -50,10 +50,6 @@ export default {
50
50
  align: String,
51
51
  border: Boolean,
52
52
  type: String,
53
- maxLength: {
54
- type: Number,
55
- default: 12
56
- },
57
53
  min: [String, Number],
58
54
  max: [String, Number],
59
55
  step: [String, Number],
@@ -89,6 +85,12 @@ export default {
89
85
  isFromReadonly () {
90
86
  return this.form ? this.form.readonly : false
91
87
  },
88
+ maxLength () {
89
+ if (this.type === 'integer') {
90
+ return this.maxNum ? `${this.maxNum}`.length : 9
91
+ }
92
+ return this.maxNum ? (`${this.maxNum}`.length + 3) : 12
93
+ },
92
94
  minNum () {
93
95
  if (XEUtils.isNumber(this.min) || this.min) {
94
96
  return XEUtils.toNumber(this.min || 0)
@@ -129,8 +131,8 @@ export default {
129
131
  return { status: true, value: this.inpVal }
130
132
  }
131
133
  const numVal = XEUtils.toNumber(XEUtils.toValueString(this.inpVal).slice(0, this.maxLength))
132
- if (this.type === 'integer' && !/^[0-9]$/.test(numVal)) {
133
- const value = XEUtils.toInteger(numVal)
134
+ if (this.type === 'integer' && !/^[0-9]+$/.test(numVal)) {
135
+ const value = this.maxNum ? Math.max(this.maxNum, XEUtils.toInteger(numVal)) : XEUtils.toInteger(numVal)
134
136
  this.$emit('input', value)
135
137
  return { status: false, value: value }
136
138
  }
@@ -299,7 +299,7 @@ export default {
299
299
  },
300
300
  previewDocs (item) {
301
301
  // 仅支持文档和图片
302
- if (previewTypes.includes(item[this.typeField])) {
302
+ if (this.previewTypes.includes(item[this.typeField])) {
303
303
  uni.downloadFile({
304
304
  url: this.getUrl(item),
305
305
  success: (downRes) => {
@@ -308,7 +308,7 @@ export default {
308
308
  filePath: downRes.tempFilePath,
309
309
  showMenu: true,
310
310
  success () {},
311
- fail () {
311
+ fail: () => {
312
312
  uni.showModal({
313
313
  content: '打开失败',
314
314
  showCancel: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.79",
3
+ "version": "0.2.80",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"