mali-applet-ui 0.1.4 → 0.1.6
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.
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
<view v-if="isFromReadonly" class="ml-amount-input is-readonly">
|
|
3
3
|
<view class="ml-amount-input-readonly-content">¥{{ amountLabel }}</view>
|
|
4
4
|
</view>
|
|
5
|
-
<input
|
|
6
|
-
v-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
<view v-else class="ml-amount-input" :class="[{'is-right': align === 'right', 'is-border': border}, className]">
|
|
6
|
+
<view v-if="showTip" class="ml-amount-tip">
|
|
7
|
+
<text>首位:</text>
|
|
8
|
+
<text>{{ firstNumLabel }}</text>
|
|
9
|
+
</view>
|
|
10
|
+
<input
|
|
11
|
+
v-model="inpVal"
|
|
12
|
+
type="digit"
|
|
13
|
+
class="ml-amount-input-inp"
|
|
14
|
+
autocomplete="off"
|
|
15
|
+
:placeholder="placeholder"
|
|
16
|
+
:maxlength="maxLength"
|
|
17
|
+
:disabled="disabled"
|
|
18
|
+
@blur="blurEvent"
|
|
19
|
+
@input="inputEvent" />
|
|
20
|
+
</view>
|
|
17
21
|
</template>
|
|
18
22
|
|
|
19
23
|
<script>
|
|
@@ -49,6 +53,7 @@ export default {
|
|
|
49
53
|
type: Boolean,
|
|
50
54
|
default: false
|
|
51
55
|
},
|
|
56
|
+
showTip: Boolean,
|
|
52
57
|
className: String
|
|
53
58
|
},
|
|
54
59
|
inject: {
|
|
@@ -86,6 +91,35 @@ export default {
|
|
|
86
91
|
return Number(this.max)
|
|
87
92
|
}
|
|
88
93
|
return null
|
|
94
|
+
},
|
|
95
|
+
firstNumLabel () {
|
|
96
|
+
const numVal = XEUtils.toNumber(this.value)
|
|
97
|
+
if (numVal > 999999999999) {
|
|
98
|
+
return '万亿'
|
|
99
|
+
} else if (numVal > 99999999999) {
|
|
100
|
+
return '千亿'
|
|
101
|
+
} else if (numVal > 9999999999) {
|
|
102
|
+
return '百亿'
|
|
103
|
+
} else if (numVal > 999999999) {
|
|
104
|
+
return '十亿'
|
|
105
|
+
} else if (numVal > 99999999) {
|
|
106
|
+
return '亿'
|
|
107
|
+
} else if (numVal > 9999999) {
|
|
108
|
+
return '千万'
|
|
109
|
+
} else if (numVal > 999999) {
|
|
110
|
+
return '百万'
|
|
111
|
+
} else if (numVal > 99999) {
|
|
112
|
+
return '十万'
|
|
113
|
+
} else if (numVal > 9999) {
|
|
114
|
+
return '万'
|
|
115
|
+
} else if (numVal > 999) {
|
|
116
|
+
return '千'
|
|
117
|
+
} else if (numVal > 99) {
|
|
118
|
+
return '百'
|
|
119
|
+
} else if (numVal > 9) {
|
|
120
|
+
return '十'
|
|
121
|
+
}
|
|
122
|
+
return '个'
|
|
89
123
|
}
|
|
90
124
|
},
|
|
91
125
|
watch: {
|
|
@@ -100,19 +134,23 @@ export default {
|
|
|
100
134
|
}
|
|
101
135
|
},
|
|
102
136
|
created () {
|
|
103
|
-
this.
|
|
137
|
+
this.updateValue()
|
|
104
138
|
},
|
|
105
139
|
methods: {
|
|
140
|
+
updateValue () {
|
|
141
|
+
this.inpVal = this.value ? XEUtils.toFixed(XEUtils.toNumber(this.value), 2) : ''
|
|
142
|
+
},
|
|
106
143
|
checkValue () {
|
|
107
|
-
|
|
108
|
-
this
|
|
109
|
-
|
|
144
|
+
const numVal = XEUtils.toNumber(this.value)
|
|
145
|
+
if (this.minNum !== null && (numVal < this.minNum)) {
|
|
146
|
+
this.$emit('input', this.minNum)
|
|
147
|
+
return { status: false, value: this.minNum }
|
|
110
148
|
}
|
|
111
|
-
if (this.maxNum !== null && (
|
|
112
|
-
|
|
113
|
-
|
|
149
|
+
if (this.maxNum !== null && (numVal > this.maxNum)) {
|
|
150
|
+
this.$emit('input', this.maxNum)
|
|
151
|
+
return { status: false, value: this.maxNum }
|
|
114
152
|
}
|
|
115
|
-
const val = XEUtils.floor(
|
|
153
|
+
const val = XEUtils.floor(numVal, 2)
|
|
116
154
|
if (`${val}` !== `${this.value}`) {
|
|
117
155
|
this.$emit('input', val)
|
|
118
156
|
return { status: false, value: val }
|
|
@@ -121,6 +159,7 @@ export default {
|
|
|
121
159
|
},
|
|
122
160
|
blurEvent () {
|
|
123
161
|
this.checkValue()
|
|
162
|
+
this.updateValue()
|
|
124
163
|
this.$emit('blur')
|
|
125
164
|
},
|
|
126
165
|
inputEvent () {
|
|
@@ -134,16 +173,29 @@ export default {
|
|
|
134
173
|
|
|
135
174
|
<style lang="scss">
|
|
136
175
|
.ml-amount-input {
|
|
137
|
-
|
|
138
|
-
padding: 0 10rpx;
|
|
139
|
-
height: 70rpx;
|
|
140
|
-
width: 100%;
|
|
176
|
+
position: relative;
|
|
141
177
|
&.is-right {
|
|
142
|
-
|
|
178
|
+
.ml-amount-input-inp {
|
|
179
|
+
text-align: right;
|
|
180
|
+
}
|
|
143
181
|
}
|
|
144
182
|
&.is-border {
|
|
145
|
-
|
|
146
|
-
|
|
183
|
+
.ml-amount-input-inp {
|
|
184
|
+
border: 1px solid #e5e5e5;
|
|
185
|
+
border-radius: 10rpx;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
.ml-amount-tip {
|
|
189
|
+
position: absolute;
|
|
190
|
+
top: -60rpx;
|
|
191
|
+
right: 10rpx;
|
|
192
|
+
z-index: 1;
|
|
193
|
+
}
|
|
194
|
+
.ml-amount-input-inp {
|
|
195
|
+
font-size: $uni-font-size-base;
|
|
196
|
+
width: 100%;
|
|
197
|
+
height: 70rpx;
|
|
198
|
+
padding: 0 10rpx;
|
|
147
199
|
}
|
|
148
200
|
}
|
|
149
201
|
.ml-amount-input-readonly-content {
|
|
@@ -93,15 +93,17 @@ export default {
|
|
|
93
93
|
&.size-medium {
|
|
94
94
|
height: 90rpx;
|
|
95
95
|
line-height: 90rpx;
|
|
96
|
-
font-size:
|
|
96
|
+
font-size: 36rpx;
|
|
97
97
|
}
|
|
98
98
|
&.size-small {
|
|
99
99
|
height: 70rpx;
|
|
100
100
|
line-height: 70rpx;
|
|
101
|
+
font-size: 28rpx;
|
|
101
102
|
}
|
|
102
103
|
&.size-mini {
|
|
103
104
|
height: 60rpx;
|
|
104
105
|
line-height: 60rpx;
|
|
106
|
+
font-size: 24rpx;
|
|
105
107
|
}
|
|
106
108
|
&.status-primary {
|
|
107
109
|
color: #ffffff;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<ml-select-picker v-else-if="matchComponent('MlSelectPicker')" :value="itemValue" :options="renderOpts.options" border @change="modelEvent"></ml-select-picker>
|
|
15
15
|
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" :showVoice="renderOpts.showVoice || true" border @change="modelEvent"></ml-textarea>
|
|
16
16
|
<ml-upload v-else-if="matchComponent('MlUpload')" :value="itemValue" :mediatype="renderOpts.mediatype || 'image'" @change="modelEvent"></ml-upload>
|
|
17
|
-
<ml-amount-input v-else-if="matchComponent('MlAmountInput')" :value="itemValue" border @change="modelEvent"></ml-amount-input>
|
|
17
|
+
<ml-amount-input v-else-if="matchComponent('MlAmountInput')" :value="itemValue" :showTip="itemVertical" border @change="modelEvent"></ml-amount-input>
|
|
18
18
|
<ml-amount-text v-else-if="matchComponent('MlAmountText')" :value="itemValue" @change="modelEvent"></ml-amount-text>
|
|
19
19
|
<text v-else class="ml-form-item-default-content">{{ itemValue }}</text>
|
|
20
20
|
</slot>
|
|
@@ -176,7 +176,6 @@ export default {
|
|
|
176
176
|
}
|
|
177
177
|
.ml-form-item-header {
|
|
178
178
|
min-height: 70rpx;
|
|
179
|
-
color: rgba(0, 0, 0, 0.65);
|
|
180
179
|
}
|
|
181
180
|
.ml-form-item-header-asterisk {
|
|
182
181
|
display: inline;
|
|
@@ -192,6 +191,7 @@ export default {
|
|
|
192
191
|
&:not(.is-vertical) {
|
|
193
192
|
.ml-form-item-header {
|
|
194
193
|
flex-shrink: 0;
|
|
194
|
+
color: rgba(0, 0, 0, 0.65);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
&.title-align-left {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
class="ml-input-inp"
|
|
14
14
|
autocomplete="off"
|
|
15
15
|
:placeholder="placeholder"
|
|
16
|
+
:maxlength="maxlength"
|
|
16
17
|
@input="inputEvent"
|
|
17
18
|
@confirm="confirmEvent"/>
|
|
18
19
|
<view v-if="suffixIcon" class="ml-input-suffix-icon">
|
|
@@ -39,6 +40,10 @@ export default {
|
|
|
39
40
|
type: String,
|
|
40
41
|
default: '请输入'
|
|
41
42
|
},
|
|
43
|
+
maxlength: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: '50'
|
|
46
|
+
},
|
|
42
47
|
className: String
|
|
43
48
|
},
|
|
44
49
|
inject: {
|