1.0.2 • Published 5 years ago

mr-vue-puzzle v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

mr-vue-puzzle

基于公司需求扩展 vue-puzzle-verification原作者路径

新增参数 forbid title及交互优化

使用:

npm i mr-vue-puzzle

局部引用:

import PuzzleVerification from 'vue-puzzle-verification'

效果展示

1. 简单用法:

<div class="login-box">
  <button @click="handleClick(1)">最简单用法</button>
  <div class="puzzle-box">
    <PuzzleVerification
      v-model="isVerificationShow1"
      :onSuccess="handleSuccess"
    />
  </div>
</div>

2. 拼图形滑块:

<div class="login-box">
 <button @click="handleClick(2)">拼图形滑块</button>
 <div class="puzzle-box">
   <PuzzleVerification
     v-model="isVerificationShow2"
     :puzzleImgList="puzzleImgList"
     blockType="puzzle"
     :onSuccess="handleSuccess"
   />
 </div>
</div>

3. 控制大小:

<div class="login-box">
  <button @click="handleClick(3)">控制大小</button>
  <div class="puzzle-box">
    <PuzzleVerification
      v-model="isVerificationShow3"
      width="300"
      height="200"
      blockSize="80"
      blockRadius="5"
      :onSuccess="handleSuccess"
    />
  </div>
</div>

4. 控制误差:

<div class="login-box">
  <button @click="handleClick(4)">控制误差</button>
  <div class="puzzle-box">
    <PuzzleVerification
      v-model="isVerificationShow4"
      :puzzleImgList="puzzleImgList"
      deviation="20"
      blockType="puzzle"
      :onSuccess="handleSuccess"
    />
  </div>
</div>

5. 滑块出现的范围:

<div class="login-box">
  <button @click="handleClick(5)">控制滑块出现位置范围</button>
  <div class="puzzle-box">
    <PuzzleVerification
      v-model="isVerificationShow5"
      wraperPadding="50"
      :onSuccess="handleSuccess"
    />
  </div>
</div>

参数说明

参数是否必需类型可选值默认值说明
v-model---------绑定显示与隐藏
blockTypestringsquare, puzzlepuzzle滑块的形状
forbidbooleantrue, falsefalse悬浮滑块是否显示图片
titlestringstring-滑条内容
blockSizestring, number0 ~40滑块的大小(正方形),不能大于画布尺寸
widthstring, number0 ~260画布图片的宽度
heightstring, number0 ~120画布图片的高度
puzzleImgListarray---三张引用图片传入的图片
blockRadiusstring, number0 ~4滑块圆角的大小(仅当其形状是square有效)
deviationstring, number0 ~4滑块吻合的误差
wraperPaddingstring, number0 ~20滑块随机出现的范围,数字越大,范围越大(不能大于画布尺寸)
onSuccessfunction---打印成功信息拼接成功时的回调
onErrorfunction---打印失败信息拼接失败时的回调