javascript - VueJS 滑块组件 - 禁用特定范围的值,例如。85-100?
问题描述
嘿伙计们,我需要一个特定范围的滑块被禁用但仍然显示。
滑块是 vue-component-slider 包
例如,我们有一个名为 previousRange 的项目有多少可用的值假设数字是 85,滑块应显示 0-100 但不能超过 85 或动态数字,知道如何做到这一点吗?非常感谢您!
滑块组件:
<template>
<div>
<vue-slider
v-model="range"
:marks="marks"
:tooltip="'active'"
v-bind="options"
:order="false"
></vue-slider>
</div>
</template>
<script>
import VueSlider from "vue-slider-component";
import "vue-slider-component/theme/default.css";
//import 'vue-slider-component/theme/antd.css'
export default {
components: {
VueSlider,
},
data() {
return {
range: 0,
options: {
dotOptions: [
{
style: {
backgroundColor: "#00008B",
},
},
],
},
};
},
props: {
id: {
type: String,
},
//previousRange means the range from earlier process that has happened on the unit
//this is added so user can only select upto the previous range value instead of 100
previousRange: {
type: Number,
default: 100,
},
},
computed: {
marks: function () {
if (!this.previousRange) return [0,100];
return [0, this.previousRange];
},
},
watch: {
range: function (val) {
this.$emit("on-range-change", val);
},
},
};
</script>
解决方案
推荐阅读
- java - 使用反射从隐藏的 AOSP 类中获取私有字段
- javascript - React,this.props 没有定义
- java - 程序类型已经存在:javax.inject.Named + transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
- javascript - sequelize.query() 抛出未处理的拒绝
- javascript - 错误 TS2554:预期 3-4 个参数,但得到 5
- python - 仅将月份从“jan”更改为 1,“feb”更改为 2,“mar”更改为 3...“dec”更改为 12
- flutter - Flutter 新的 Web 项目未显示在 Visual Studio 命令面板中
- qt - QT项目如何生成compile_commands.json?
- javascript - 在画布中选择新图像对象时取消选中复选框(Fabricjs)
- node.js - 如何修复“页面上的错误:ReferenceError:找不到变量:需要”-带有 Sinon.js 的 NodeJS