slider组件
This commit is contained in:
parent
1a7cd1b33f
commit
63d1e7538d
@ -5,11 +5,16 @@
|
||||
@mousedown.stop="handle_mousedown"
|
||||
class="layui-slider-vertical-track"
|
||||
>
|
||||
<lay-tooltip :content="modelValue + ''">
|
||||
<div
|
||||
:style="{ bottom: modelValue + '%' }"
|
||||
class="layui-slider-vertical-btn"
|
||||
></div>
|
||||
<div :style="{ height: modelValue + '%' }" class="layui-slider-vertical-rate"></div>
|
||||
</lay-tooltip>
|
||||
<div
|
||||
:style="{ height: modelValue + '%' }"
|
||||
class="layui-slider-vertical-rate"
|
||||
></div>
|
||||
<div class="layui-slider-vertical-line"></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -120,13 +125,13 @@ const verticalMove = (e: MouseEvent) => {
|
||||
let tracker_rect = verticaltracker.value.getBoundingClientRect();
|
||||
let origin_bottom = tracker_rect.bottom;
|
||||
let point_bottom = e.clientY;
|
||||
let distance = (point_bottom - origin_bottom) * -1
|
||||
let distance = (point_bottom - origin_bottom) * -1;
|
||||
if (distance < 0) {
|
||||
vertical_style.bottom = 0;
|
||||
vertical_style.height = 0;
|
||||
} else {
|
||||
let rate = (distance / tracker_rect.height) * 100;
|
||||
console.log(rate)
|
||||
console.log(rate);
|
||||
vertical_style.bottom = Math.floor(rate);
|
||||
vertical_style.height = Math.floor(rate);
|
||||
if (vertical_style.bottom > 100) {
|
||||
|
Loading…
Reference in New Issue
Block a user