mali-applet-ui 0.2.80 → 0.2.82

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.
@@ -46,10 +46,7 @@ export default {
46
46
  value: [String, Number],
47
47
  align: String,
48
48
  border: Boolean,
49
- min: {
50
- type: [Number, String],
51
- default: 0
52
- },
49
+ min: [Number, String],
53
50
  max: {
54
51
  type: [Number, String],
55
52
  default: 9999999999
@@ -58,6 +55,7 @@ export default {
58
55
  type: Number,
59
56
  default: 12
60
57
  },
58
+ negative: Boolean,
61
59
  placeholder: {
62
60
  type: String,
63
61
  default: '请输入'
@@ -101,13 +99,16 @@ export default {
101
99
  },
102
100
  minNum () {
103
101
  if (XEUtils.isNumber(this.min) || this.min) {
104
- return Number(this.min || 0)
102
+ return Number(this.min || 0)
105
103
  }
106
- return null
104
+ if (this.negative) {
105
+ return -9999999999
106
+ }
107
+ return 0
107
108
  },
108
109
  maxNum () {
109
110
  if (XEUtils.isNumber(this.max) || this.max) {
110
- return Number(this.max)
111
+ return Number(this.max)
111
112
  }
112
113
  return null
113
114
  },
@@ -131,11 +131,6 @@ export default {
131
131
  return { status: true, value: this.inpVal }
132
132
  }
133
133
  const numVal = XEUtils.toNumber(XEUtils.toValueString(this.inpVal).slice(0, this.maxLength))
134
- if (this.type === 'integer' && !/^[0-9]+$/.test(numVal)) {
135
- const value = this.maxNum ? Math.max(this.maxNum, XEUtils.toInteger(numVal)) : XEUtils.toInteger(numVal)
136
- this.$emit('input', value)
137
- return { status: false, value: value }
138
- }
139
134
  if (this.minNum !== null && (numVal < this.minNum)) {
140
135
  this.$emit('input', this.minNum)
141
136
  return { status: false, value: this.minNum }
@@ -144,6 +139,11 @@ export default {
144
139
  this.$emit('input', this.maxNum)
145
140
  return { status: false, value: this.maxNum }
146
141
  }
142
+ if (this.type === 'integer' && !/^-?[0-9]+$/.test(numVal)) {
143
+ const value = XEUtils.toInteger(numVal)
144
+ this.$emit('input', value)
145
+ return { status: false, value: value }
146
+ }
147
147
  if (`${numVal}` !== this.inpVal) {
148
148
  this.$emit('input', numVal)
149
149
  return { status: false, value: numVal }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.80",
3
+ "version": "0.2.82",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"