npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slider-verify-v3

v1.1.12

Published

一个基于vue3.js和canvas的滑块拼图校验插件

Downloads

19

Readme

一个基于vue3.js和canvas的滑块拼图校验插件, 支持PC、移动端.

Demo演示

Demohttps://portal.fuyunfeng.top/plugins_v3/index.html

在vue2.js中使用?: https://github.com/author-fuyf/slider-verify-v2

使用

vue-cli

vue-cli 中使用

  1. 首先安装插件
# npm 安装:
npm install slider-verify-v3 -S
  1. main.js 中引入
import SliderVerify from 'slider-verify-v3'
import 'slider-verify-v3/lib/SliderVerify.css'
createApp(App).use(SliderVerify)
  1. 组件中声明
<template>
  <div>
    <SliderVerify
      v-model:isShowSelf="sliderVConf.isShowSelf"
      :imgUrl="sliderVConf.imgUrl"
      :sText="sliderVConf.sText"
      :eText="sliderVConf.eText"
      :isBorder="sliderVConf.isBorder"
      :isParentNode="sliderVConf.isParentNode"
      :isCloseBtn="sliderVConf.isCloseBtn"
      :isReloadBtn="sliderVConf.isReloadBtn"
      :is-show-tip="isShowTip"
      :width="sliderVConf.width"
      :height="sliderVConf.height"
      @reload="emitChange('reload')"
      @show="emitChange('show')"
      @hide="emitChange('hide')"
      @close="emitChange('close')"
      @success="emitChange('success')"
      @fail="emitChange('fail')"
    ></SliderVerify>
  </div>
</template>

script标签

实际使用建议下载到本地或服务器

<meta charset="utf-8">
<title>SliderVerify demo</title>
<link rel="stylesheet" href="https://portal.fuyunfeng.top/api/files/download_file?file_name=SliderVerify-v3.css">
<body>
  <div id="app">
    <slider-verify 
      v-model:is-show-self="isShowSelf"
      :width="width"
      :height="height"
      :img-url="imgUrl"
      :s-text="sText"
      :e-text="eText"
      :is-border="isBorder"
      :is-close-btn="isCloseBtn"
      :is-reload-btn="isReloadBtn"
      :is-parent-node="isParentNode"
      :is-show-tip="isShowTip"
      @reload="emitChange('reload')"
      @show="emitChange('show')"
      @hide="emitChange('hide')"
      @close="emitChange('close')"
      @success="emitChange('success')"
      @fail="emitChange('fail')"></slider-verify>
  </div>
</body>
<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<script src="https://portal.fuyunfeng.top/api/files/download_file?file_name=SliderVerify.umd-v3.js"></script>

<script>
  const app = Vue.createApp({
    data() {
      return {
        isShowSelf: true,
        width: 300,
        height: 180,
        imgUrl: '',
        sText: 'sText',
        eText: 'eText',
        isBorder: true,
        isCloseBtn: true,
        isReloadBtn: true,
        isParentNode: false,
        isShowTip: true,
      }
    },
    methods: {
      emitChange(type) {
        console.log(type)
      }
    }
  })
  app.use(SliderVerify).mount('#app')
</script>

更详细的

参数

  • isShowSelf: 显隐控制,组件自身提供关闭功能按钮,建议v-model:is-show-self绑定,否则需要在close回调事件中自行处理, 默认 false.
  • width: 图片宽度 默认 300.
  • height: 图片高度 默认 180.
  • imgUrl: 自定义图片地址, 如https://...的绝对路径, 需要设置资源允许跨域, 默认图片随机切换.
  • sText: 校验成功的提示, 默认 验证通过.
  • eText: 校验失败的提示, 默认 请正确拼合图像.
  • isShowTip: 校验结果轻提示, 默认 true
  • isBorder: 自带的外层边框, 默认 true.
  • isCloseBtn: 底部操作栏 - 关闭按钮, 默认 true.
  • isReloadBtn: 底部操作栏 - 刷新按钮, 默认 true.
  • isParentNode: 是否以父级宽度控制, 在类似其他外部弹窗中调用时很有用, 无需指定宽度, 以父级宽度为准, 默认 false

事件

  • show: 展现时触发.
  • hide: 隐藏时触发.
  • close: 主动关闭时触发.
  • success: 校验成功时触发.
  • fail: 校验失败时触发.
  • reload: 刷新时触发.

参考链接