1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
<div class="app-stepper">
<el-input-number
v-model="currentVal"
:disabled="disabled || readonly"
size="small"
:min="min"
:max="max"
:step="step"
@blur="blur"
@focus="focus"
></el-input-number>
</div>
</template>
<script lang='ts'>
import { Component, Vue, Prop, } from "vue-property-decorator";
@Component({})
export default class AppStepper extends Vue {
/**
* 传入值
* @type {any}
* @memberof AppStepper
*/
@Prop() public value?: any;
/**
* 属性项名称
*
* @type {string}
* @memberof AppPicker
*/
@Prop() public name!: string;
/**
* 是否禁用
* @type {boolean}
* @memberof AppStepper
*/
@Prop() public disabled?: boolean;
/**
* 只读模式
*
* @type {boolean}
*/
@Prop({ default: false }) public readonly?: boolean;
/**
* 步长
* @type {number}
* @memberof AppStepper
*/
@Prop({ default: 1 }) public step!: number;
/**
* 最小值
* @type {number}
* @memberof AppStepper
*/
@Prop({ default: 0 }) public min!: number;
/**
* 最大值
* @type {number}
* @memberof AppStepper
*/
@Prop({ default: 100 }) public max!: number;
/**
* 当前值
*
* @memberof AppStepper
*/
get currentVal() {
return this.value ? this.value : 0;
}
/**
* 设置当前值
*
* @memberof AppStepper
*/
set currentVal(val) {
this.$emit('change', { name: this.name, value: val });
}
/**
* 失去焦点事件
*
* @memberof AppStepper
*/
public blur(event: any) {
this.$emit('blur', event);
}
/**
* 聚焦事件
*
* @memberof AppStepper
*/
public focus(event: any) {
this.$emit('focus', event);
}
}
</script>