代码拉取完成,页面将自动刷新
<template>
<view class="u-page">
<card title="基础用法">
<view class="u-demo-area">
<u-slider-button
:text="'滑动解锁'"
@success="onSliderSuccess"
@reset="onSliderReset"
/>
</view>
</card>
<card title="自定义样式">
<view class="u-demo-area">
<u-slider-button
:text="sliderData.text"
:successText="sliderData.successText"
:bgColor="sliderData.bgColor"
:railColor="sliderData.railColor"
:height="45"
textColor="#ffffff"
:textBold="true"
railIndex="10"
threshold="150"
autoReset
@reset="onCustomSuccess"
/>
</view>
</card>
<card title="禁用状态">
<view class="u-demo-area">
<u-slider-button
:text="'已禁用'"
:width="300"
:height="50"
:disabled="true"
/>
</view>
</card>
</view>
</template>
<script>
export default {
data() {
return {
sliderRef: null,
sliderData: {
text: '开始出发',
successText: '开始出发',
bgColor: 'rgb(230, 27, 47)',
railColor: 'rgba(230, 27, 47, 0.85)'
}
}
},
methods: {
// 基础用法 - 滑动成功
onSliderSuccess() {
uni.showToast({
title: '滑动验证成功!',
icon: 'success'
});
},
// 基础用法 - 重置
onSliderReset() {
console.log('滑动按钮已重置');
},
// 自定义样式 - 滑动成功
onCustomSuccess() {
this.sliderData = {
text: '接到乘客',
successText: '接到乘客',
bgColor: 'rgb(47, 230, 117)',
railColor: 'rgba(47, 230, 117, 0.85)'
}
}
},
}
</script>
<style lang="scss">
.u-demo-area{
padding: 20px 0;
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。