1.0.7 • Published 8 months ago

input-slide-style v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

input-slide-style

Vue2组件,用于实现input滑动条自定义样式,支持更改轨道和滑块的样式。

Install

npm install input-slide-style

Usage

main.js

import InputSlideStyle from 'input-slide-style'
Vue.use(InputSlideStyle)

.vue

<template>
    <div>
        <InputSlideStyle></InputSlideStyle>
    </div>
</template>

Demo

Demo1

Image

<template>
    <InputSlideStyle></InputSlideStyle>
</template>

Demo2

Image

<template>
    <InputSlideStyle
      :showHollow="false"
      backgroundColor="#a0a0a1"
      speedColor="#5db9f8"
      :rangeStyle="rangeStyle"
    >
    </InputSlideStyle>
</template>

export default {
    data() {
        return {
            rangeStyle: {
                border: 0,
                background: "red",
                borderRadius: 0
            },
        };
    }
}

Demo3

Image

<template>
    <InputSlideStyle
      :showHollow="false"
      backgroundColor="#a0a0a1"
      speedColor="#5db9f8"
      :inputHeight="22"
      borderRadius="0"
      :rangeStyle="rangeStyle"
    >
      <template slot="slideThumb">
        <div class="thumb">→</div>
      </template>
    </InputSlideStyle>
</template>

export default {
    data() {
        return {
            rangeStyle: {
                border: 0,
                background: "#4e6ef2",
                borderRadius: 0
            },
        };
    },
}
<style lang="less" scoped>
  .thumb {
    color: #fff;
    text-align: center;
    line-height: 22px;
  }
</style>

Props

属性说明类型默认值
inputWidth滑动条宽度Number300
inputHeight滑动条高度Number4
rangeWidth滑块宽度Number22
rangeHeight滑块高度Number22
maxNum滑动条最大值Number100
maxPercentage滑动条最大计算比例Number100
showHollow是否显示默认空心圆Booleantrue
backgroundColor滑动条背景色String'#a3c6bd'
speedColor滑动条进度色String'#3cb5c3'
borderRadius滑动条圆角String'3px'
rangeStyle滑块样式Object{}
slideThumb滑块具名插槽slot--

Event

事件名说明返回值
change拖动滑块时会触发当前进度百分比
1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago