👉使用方法,跟数1,2,3一样简单


温馨提示1.2.24

长按加减按钮,可以持续增加或者减少数字。

完整示例

<template>
	<tm-fullView>
		<template v-slot:default="{info}">
			<view class="grey text " :class="$tm.vx.state().tmVuetify.black?'black bk':''" :style="{minHeight:info.height+'px'}">
				<tm-menubars title="步进器" color="bg-gradient-blue-accent" :showback="true"></tm-menubars>
				<tm-sheet :shadow="24">
					<view class="pa-12 text-size-s text-weight-b blue text mb-32 round-2" :class="$tm.vx.state().tmVuetify.black?'black bk':''" >基础示例</view>
					<tm-stepper width="260"  v-model="word2"></tm-stepper>
				</tm-sheet>
				<tm-sheet :shadow="24">
					<view class="pa-12 text-size-s text-weight-b blue text mb-32 round-2" :class="$tm.vx.state().tmVuetify.black?'black bk':''" >步幅以及高度的设置</view>
					<tm-stepper height="80" v-model="word" :step="10" color="bg-gradient-pink-accent"></tm-stepper>
				</tm-sheet>
				<tm-sheet :shadow="24">
					<tm-stepper width="300" v-model="word" :step="10" color="blue" :round="24"></tm-stepper>
					<tm-stepper v-model="word" :step="10" color="bg-gradient-blue-accent" :round="24"></tm-stepper>
				</tm-sheet>
				<view style="height: 50upx;"></view>
			</view>
		</template>
	</tm-fullView>

</template>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script>
	import tmFullView from "@/tm-vuetify/components/tm-fullView/tm-fullView.vue"
	import tmMenubars from "@/tm-vuetify/components/tm-menubars/tm-menubars.vue"
	import tmSheet from "@/tm-vuetify/components/tm-sheet/tm-sheet.vue"
	import tmStepper from "@/tm-vuetify/components/tm-stepper/tm-stepper.vue"
	export default {
		components:{tmFullView,tmMenubars,tmSheet,tmStepper},
		data() {
			return {
				word2:0,
				word:0
			}
		},
		methods: {
			
		}
	}
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

👉props属性表

属性名称类型可选值默认值说明
blackBooleantrue/falsefalse暗黑模式
disabledBooleantrue/falsefalse是否禁用
colorString任意主题色名称primary主题色
font-colorString任意主题色名称black输入框的文字主题色
stepNumber任意数字1步幅
valueNumber任意数字0推荐使用value.sync或者v-model
roundNumber任意数字0-253圆角
shadowNumber任意数字0-253投影
max1.2.24Number任意数字999最大值
min1.2.24Number任意数字0最小值
width1.2.24Number任意数字200宽度,单位rpx
height1.2.24Number任意数字70高度,单位rpx
name1.1.7String''''提交表单时的的字段名称标识
disabledInput1.2.297Booleantrue/falsefalse是否禁用输入框
circular1.2.297Booleantrue/falsefalse按钮四角是否跟随圆角
fixed1.2.297Number任意数字NaN默认可任意小数,整数。如果为0表示只为整数,如果大于0表示固定小数点位数
callback1.2.24Function函数见下方文档异步回调增减

关于callback函数,因为vue2.0在uniapp中属性无法赋值function类型,因此需要像下方配置回调函数

//word5为绑定的变量。
<tm-stepper :callback="callback" v-model="word5" :step="1" color="bg-gradient-pink-accent"></tm-stepper>
//callback为上方属性中的异步回调函数。
callback(){
	return new Promise((res,rej)=>{
		//1秒后返回操作的结果,是否执行增减操作。
		setTimeout(function(){
			res(true);//true,表示增减成功。
			//res(fale);//fale,表示增减失败,不会执行步进器的操作。
		},1000)
	})
}

1
2
3
4
5
6
7
8
9
10
11
12
13

👉事件

事件名称返回参数返参类型说明
@change当前变量Number当值发生改变时触发

👉更新日志

2021年8月20日14:8:5 初始版本。

tmzdy 于 2022/12/7 编辑 报错? | 评论?