mirror of
https://github.com/yangzongzhuan/RuoYi-App.git
synced 2025-09-27 22:52:40 +00:00
升级uni-ui到最新版本1.5.7
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
## 1.2.8(2024-04-26)
|
||||
- 修复 在vue2下H5黑边的bug
|
||||
## 1.2.7(2024-04-26)
|
||||
- 修复 在vue2手动输入后失焦导致清空数值的严重bug
|
||||
## 1.2.6(2024-02-22)
|
||||
- 新增 设置宽度属性width(单位:px)
|
||||
## 1.2.5(2024-02-21)
|
||||
- 修复 step步长小于1时,键盘类型为number的bug
|
||||
## 1.2.4(2024-02-02)
|
||||
- 修复 加减号垂直位置偏移样式问题
|
||||
## 1.2.3(2023-05-23)
|
||||
- 更新示例工程
|
||||
## 1.2.2(2023-05-08)
|
||||
- 修复 change 事件执行顺序错误的问题
|
||||
## 1.2.1(2021-11-22)
|
||||
- 修复 vue3中某些scss变量无法找到的问题
|
||||
## 1.2.0(2021-11-19)
|
||||
|
@@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<view class="uni-numbox">
|
||||
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}">
|
||||
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{color}">-</text>
|
||||
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }"
|
||||
:style="{color}">-</text>
|
||||
</view>
|
||||
<input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" type="number"
|
||||
v-model="inputValue" :style="{background, color}" />
|
||||
<input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value"
|
||||
:type="step<1?'digit':'number'" v-model="inputValue" :style="{background, color, width:widthWithPx}" />
|
||||
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}">
|
||||
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{color}">+</text>
|
||||
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }"
|
||||
:style="{color}">+</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -21,6 +23,7 @@
|
||||
* @property {Number} step 每次点击改变的间隔大小
|
||||
* @property {String} background 背景色
|
||||
* @property {String} color 字体颜色(前景色)
|
||||
* @property {Number} width 输入框宽度(单位:px)
|
||||
* @property {Boolean} disabled = [true|false] 是否为禁用状态
|
||||
* @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
|
||||
* @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象
|
||||
@@ -62,6 +65,10 @@
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 40,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -77,6 +84,11 @@
|
||||
this.inputValue = +val;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
widthWithPx() {
|
||||
return this.width + 'px';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.value === 1) {
|
||||
this.inputValue = +this.modelValue;
|
||||
@@ -114,11 +126,11 @@
|
||||
}
|
||||
|
||||
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
|
||||
this.$emit("change", +this.inputValue);
|
||||
// TODO vue2 兼容
|
||||
this.$emit("input", +this.inputValue);
|
||||
// TODO vue3 兼容
|
||||
this.$emit("update:modelValue", +this.inputValue);
|
||||
this.$emit("change", +this.inputValue);
|
||||
},
|
||||
_getDecimalScale() {
|
||||
|
||||
@@ -133,7 +145,7 @@
|
||||
this.$emit('blur', event)
|
||||
let value = event.detail.value;
|
||||
if (isNaN(value)) {
|
||||
this.inputValue = this.min;
|
||||
this.inputValue = this.value;
|
||||
return;
|
||||
}
|
||||
value = +value;
|
||||
@@ -144,9 +156,9 @@
|
||||
}
|
||||
const scale = this._getDecimalScale();
|
||||
this.inputValue = value.toFixed(String(scale).length - 1);
|
||||
this.$emit("change", +this.inputValue);
|
||||
this.$emit("input", +this.inputValue);
|
||||
this.$emit("update:modelValue", +this.inputValue);
|
||||
this.$emit("change", +this.inputValue);
|
||||
},
|
||||
_onFocus(event) {
|
||||
this.$emit('focus', event)
|
||||
@@ -154,7 +166,7 @@
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" >
|
||||
<style lang="scss">
|
||||
$box-height: 26px;
|
||||
$bg: #f5f5f5;
|
||||
$br: 2px;
|
||||
@@ -188,8 +200,7 @@
|
||||
height: $box-height;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
border-left-width: 0;
|
||||
border-right-width: 0;
|
||||
border-width: 0;
|
||||
color: $color;
|
||||
}
|
||||
|
||||
@@ -206,7 +217,7 @@
|
||||
.uni-numbox--text {
|
||||
// fix nvue
|
||||
line-height: 20px;
|
||||
|
||||
margin-bottom: 2px;
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
color: $color;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-number-box",
|
||||
"displayName": "uni-number-box 数字输入框",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.8",
|
||||
"description": "NumberBox 带加减按钮的数字输入框组件,用户可以控制每次点击增加的数值,支持小数。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@@ -15,11 +15,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@@ -36,7 +32,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-scss"],
|
||||
@@ -44,7 +41,8 @@
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
"aliyun": "y",
|
||||
"alipay": "n"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
|
Reference in New Issue
Block a user