Skip to content

FxCaptchaSlider 滑块验证 ​

按住滑块拖到最右端即通过。支持 isSlot 插槽模式作为旋转/拼图验证码的基座。

基础用法 ​

vue
<script setup lang="ts">
import { ref } from "vue"
import { FxCaptchaSlider } from "@fx/components"

const passed = ref(false)
const onSuccess = ({ time }) => console.log(`验证通过,用时 ${time}s`)
</script>

Attributes ​

参数说明类型默认值
v-model通过状态booleanfalse
text未通过时的提示文字string'请按住滑块拖动'
successText通过后的提示文字string'验证通过'
isSlot插槽基座模式(拖到头不自动判定,由父级置 v-model)booleanfalse

Events ​

事件名说明回调参数
success验证通过({ isPassing: boolean, time: string })
start开始拖动PointerEvent
move拖动中({ event: PointerEvent, moveDistance: number, moveX: number })
end拖动结束(松手/拖出)PointerEvent

Expose ​

方法说明
resume复位滑块(回弹动画;isSlot 下同时清通过态)

Expose 类型:CaptchaSliderActionType(组合方持有基座引用时使用)。

Slots ​

插槽说明
text内容文字(作用域:{ isPassing })
actionIcon滑块图标(作用域:{ isPassing })