Slider.san 1.5 KB
Newer Older
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
<template>
    <div class="sm-form-item">
        <label class="label">{{label}}</label>
        <div class="input-box">
            <san-slider
                on-change="handleSlideChange($event)"
                value="{{value}}"
                min="{{min}}"
                max="{{max}}"
                step="{{step}}"
            />
            <san-input-number
                min="{{min}}"
                max="{{max}}"
                step="{{step}}"
                value="{=value=}"
                on-change="handlerChange($event)"
                size="small">
            </san-input-number>
        </div>
    </div>
</template>

<script>
import Slider from 'san-mui/Slider';
import InputNumber from 'san-mui/InputNumber';
export default {
    components: {
        'san-slider': Slider,
        'san-input-number': InputNumber
    },
    initData() {
        return {
            value: '0',
            label: '',
            max: 0,
            min: 0,
            step: 0
        };
    },
    handleSlideChange(val) {
        this.data.set('value', val.toString());
    }
};
</script>

<style lang="stylus">
    .sm-form-item
        .input-box
            margin-top 10px
            .sm-slider
                display inline-block
                margin-right 20px
                margin-top 4px
                float left
                width 100px
                .sm-slider-thumb
                    transform translate(0, -50%)
            .sm-inputNumber
                width 130px
                display inline-block

</style>