mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
[new feature] Slider: add button slot (#2373)
This commit is contained in:
@@ -27,10 +27,28 @@
|
||||
<van-slider
|
||||
v-model="value4"
|
||||
:step="10"
|
||||
@change="onChange"
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('customStyle')">
|
||||
<van-slider
|
||||
v-model="value5"
|
||||
bar-height="4px"
|
||||
@change="onChange"
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('customButton')">
|
||||
<van-slider v-model="value6">
|
||||
<div
|
||||
slot="button"
|
||||
class="custom-button"
|
||||
>
|
||||
{{ value6 }}
|
||||
</div>
|
||||
</van-slider>
|
||||
</demo-block>
|
||||
</demo-section>
|
||||
</template>
|
||||
|
||||
@@ -42,6 +60,8 @@ export default {
|
||||
title2: '指定选择范围',
|
||||
title3: '禁用',
|
||||
title4: '指定步长',
|
||||
customStyle: '自定义样式',
|
||||
customButton: '自定义按钮',
|
||||
text: '当前值:'
|
||||
},
|
||||
'en-US': {
|
||||
@@ -49,6 +69,8 @@ export default {
|
||||
title2: 'Range',
|
||||
title3: 'Disabled',
|
||||
title4: 'Step size',
|
||||
customStyle: 'Custom Style',
|
||||
customButton: 'Custom Button',
|
||||
text: 'Current value: '
|
||||
}
|
||||
},
|
||||
@@ -58,7 +80,9 @@ export default {
|
||||
value1: 50,
|
||||
value2: 50,
|
||||
value3: 50,
|
||||
value4: 50
|
||||
value4: 50,
|
||||
value5: 50,
|
||||
value6: 50
|
||||
};
|
||||
},
|
||||
|
||||
@@ -71,11 +95,27 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import '../../style/var';
|
||||
|
||||
.demo-slider {
|
||||
user-select: none;
|
||||
|
||||
.van-slider {
|
||||
margin: 0 15px 30px;
|
||||
}
|
||||
|
||||
.custom-button {
|
||||
width: 26px;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
border-radius: 100px;
|
||||
background-color: @red;
|
||||
}
|
||||
|
||||
.van-doc-demo-block__title {
|
||||
padding-top: 25px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user