slider - add disabled

This commit is contained in:
wang 2021-12-19 20:25:05 +08:00
parent f0cc890411
commit 34b65ad8ae
3 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ export default {
::: demo
<template>
<lay-slider v-model="value2" :vertical="vertical"></lay-slider>
<lay-slider v-model="value2" :vertical="vertical" :disabled="true"></lay-slider>
</template>
<script>

View File

@ -55,7 +55,10 @@
top: 6px;
}
.layui-slider-disabled {
cursor: not-allowed;
cursor: not-allowed !important;
}
.layui-slider-disabled-rate {
background-color: rgb(0, 150, 136) !important;
}
// 纵向样式

View File

@ -16,6 +16,7 @@
<div
:style="{ height: modelValue + '%' }"
class="layui-slider-vertical-rate"
:class="[props.disabled ? 'layui-slider-disabled-rate' : '']"
></div>
<div class="layui-slider-vertical-line"></div>
</div>
@ -38,6 +39,7 @@
<div
:style="{ width: modelValue + '%' }"
class="layui-slider-rate-v"
:class="[props.disabled ? 'layui-slider-disabled-rate' : '']"
></div>
<div class="layui-slider-line-v"></div>
</div>
@ -140,7 +142,6 @@ const verticalMove = (e: MouseEvent) => {
vertical_style.height = 0;
} else {
let rate = (distance / tracker_rect.height) * 100;
console.log(rate);
vertical_style.bottom = Math.floor(rate);
vertical_style.height = Math.floor(rate);
if (vertical_style.bottom > 100) {