fix(touch): 修复移动端 rate, carousel 一些小问题 (#1469)

* 修复 carousel 移动端滑动切换后,点击箭头切换异常的问题

* 修复 rate 移动端滑动时,评分文本未更新的问题
This commit is contained in:
morning-star 2023-12-20 14:54:46 +08:00 committed by GitHub
parent 574214e7a4
commit dc7183f7b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -568,9 +568,12 @@
var onStart = function(e){
if(e.touches.length !== 1) return;
bindEvents();
// 重置状态
state.timeStart = Date.now();
state.pointerStart.x = state.pointerEnd.x = e.touches[0].clientX;
state.pointerStart.y = state.pointerEnd.y = e.touches[0].clientY;
state.distanceX = state.distanceY = 0;
state.direction = 'none'
options.onTouchStart && options.onTouchStart(e, state);
}

View File

@ -253,6 +253,7 @@ layui.define(['jquery', 'lay'],function(exports){
// 更新最终值
options.value = score;
if(options.text) _ul.next("span").text(options.value + "星");
options.setText && options.setText(options.value);
},
onTouchEnd: function(e, state){