Skip to content

双向滑块 xSliderDouble ​


预览

介绍 ​

此为双向滑块,单向滑块见:x-slider

平台兼容 ​

HarmonyH5andriodIOS小程序UTSUNIAPP-X SDKversion
☑☑☑️☑️☑️☑️4.76+1.1.18

文件路径 ​

ts

@/uni_modules/tmx-ui/components/x-slider-double/x-slider-double.uvue

使用 ​

ts

<x-slider-double></x-slider-double>

Props 属性 ​

名称说明类型默认值
modelValue等同v-model当前值
Array() : number[] => [0, 0] as number[]
max最大值
number100
min最小值
number0
disabled是否禁用
booleanfalse
step步进值
number1
stepCount步进刻度数量
number0
color激活时的颜色,空值取全局值
string""
bgColor默认的背景色
string"info"
size滑条的大小
string"4"
btnSize滑块的尺寸
string"32"
round滑条的圆角,空值取全局进度条值
string""
showLabel是否显示进度条上的label文本
booleanfalse
labelColor文本颜色
string"black"
labelFontSize文本文字大小
string"12"

Events 事件 ​

名称参数说明
change-拖动变换时触发
update:modelValue--

Slots 插槽 ​

名称说明数据
right右插槽value: number[]
value: number[]
percentage: number[]
percentage: number[]

Ref 方法 ​

名称参数返回值说明

示例文件路径 ​

json

/pages/biaodan/slider

示例源码 ​

uvue
vue
<template>
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">滑块 Slider</x-text>
			<x-text color="#999999" >双向和单向滑块分属两个组件</x-text>
		</x-sheet>
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-16">单向</x-text>
			<x-slider :model-value="64"></x-slider>
			<x-text  font-size="18" class=" text-weight-b my-16">显示文本和颜色及刻度</x-text>
			<x-slider :min="0" :max="100" :step="10"  :model-value="0" color="error" :show-label="true"></x-slider>
			<x-text font-size="18" class=" text-weight-b mb-16">修改条及滑块按钮大小及,min,max</x-text>
			<x-slider :min="50" :max="300"  v-model="nowValue" label-font-size="16" btn-size="32" size="10" color="success" :show-label="true"></x-slider>
			
			<view class="mt-20">
				<x-button :block="true" @click="nowValue=200">动态赋值200</x-button>
			</view>
		</x-sheet>
		
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-16">双向</x-text>
			<x-slider-double v-model="nowValueDouble1"></x-slider-double>
			<x-text font-size="18" class=" text-weight-b my-16">显示文本和颜色</x-text>
			<x-slider-double v-model="nowValueDouble2" color="error" :show-label="true"></x-slider-double>
			<x-text font-size="18" class=" text-weight-b my-16">修改条及滑块按钮大小及,min,max</x-text>
			<x-slider-double :show-label="true" :stepCount="5" :step="50" :min="50" :max="300"  v-model="nowValueDouble" btn-size="30" size="20" color="success" ></x-slider-double>
			
			<view class="mt-20">
				<x-button :block="true" @click="nowValueDouble=[50,200]">动态赋值[80,200]</x-button>
			</view>
		</x-sheet>
</template>

<script setup lang="ts">
	import { ref } from 'vue'
	const nowValue = ref(80)
	const nowValueDouble1 = ref<number[]>([10,30])
	const nowValueDouble2 = ref<number[]>([30,80])
	const nowValueDouble = ref<number[]>([100,150])
	
</script>

<style lang="scss">

</style>
最近更新