mirror of
https://github.com/yangzongzhuan/RuoYi-App.git
synced 2025-09-27 22:52:40 +00:00
升级uni-ui到最新版本1.4.27
This commit is contained in:
@@ -257,33 +257,35 @@
|
||||
/**
|
||||
* 获取星星个数
|
||||
*/
|
||||
_getRateCount(clientX) {
|
||||
this._getSize()
|
||||
const size = Number(this.size)
|
||||
if (isNaN(size)) {
|
||||
return new Error('size 属性只能设置为数字')
|
||||
}
|
||||
const rateMoveRange = clientX - this._rateBoxLeft
|
||||
let index = parseInt(rateMoveRange / (size + this.marginNumber))
|
||||
index = index < 0 ? 0 : index;
|
||||
index = index > this.max ? this.max : index;
|
||||
const range = parseInt(rateMoveRange - (size + this.marginNumber) * index);
|
||||
let value = 0;
|
||||
if (this._oldValue === index && !this.PC) return;
|
||||
this._oldValue = index;
|
||||
if (this.allowHalf) {
|
||||
if (range > (size / 2)) {
|
||||
value = index + 1
|
||||
} else {
|
||||
value = index + 0.5
|
||||
}
|
||||
} else {
|
||||
value = index + 1
|
||||
}
|
||||
|
||||
value = Math.max(0.5, Math.min(value, this.max))
|
||||
this.valueSync = value
|
||||
this._onChange()
|
||||
_getRateCount(clientX) {
|
||||
const _this = this;
|
||||
this._getSize(function() {
|
||||
const size = Number(_this.size)
|
||||
if (isNaN(size)) {
|
||||
return new Error('size 属性只能设置为数字')
|
||||
}
|
||||
const rateMoveRange = clientX - _this._rateBoxLeft
|
||||
let index = parseInt(rateMoveRange / (size + _this.marginNumber))
|
||||
index = index < 0 ? 0 : index;
|
||||
index = index > _this.max ? _this.max : index;
|
||||
const range = parseInt(rateMoveRange - (size + _this.marginNumber) * index);
|
||||
let value = 0;
|
||||
if (_this._oldValue === index && !_this.PC) return;
|
||||
_this._oldValue = index;
|
||||
if (_this.allowHalf) {
|
||||
if (range > (size / 2)) {
|
||||
value = index + 1
|
||||
} else {
|
||||
value = index + 0.5
|
||||
}
|
||||
} else {
|
||||
value = index + 1
|
||||
}
|
||||
|
||||
value = Math.max(0.5, Math.min(value, _this.max))
|
||||
_this.valueSync = value
|
||||
_this._onChange()
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -300,7 +302,7 @@
|
||||
/**
|
||||
* 获取星星距离屏幕左侧距离
|
||||
*/
|
||||
_getSize() {
|
||||
_getSize(fn) {
|
||||
// #ifndef APP-NVUE
|
||||
uni.createSelectorQuery()
|
||||
.in(this)
|
||||
@@ -308,7 +310,8 @@
|
||||
.boundingClientRect()
|
||||
.exec(ret => {
|
||||
if (ret) {
|
||||
this._rateBoxLeft = ret[0].left
|
||||
this._rateBoxLeft = ret[0].left
|
||||
fn && fn()
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
@@ -316,7 +319,8 @@
|
||||
dom.getComponentRect(this.$refs['uni-rate'], (ret) => {
|
||||
const size = ret.size
|
||||
if (size) {
|
||||
this._rateBoxLeft = size.left
|
||||
this._rateBoxLeft = size.left
|
||||
fn && fn()
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
Reference in New Issue
Block a user