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

vue-scratch-card-pin

v1.0.1

Published

刮刮卡

Downloads

6

Readme

vue-scratch-card-pin

a vue component to scratch card

简介

刮刮卡vue组件,可在PC或移动端使用。

原作者地址

原作者地址

github

github地址

Install

npm install --save vue-scratch-card-pin

本人学习使用

Usage

1.通过import使用

import ScratchCard from 'vue-scratch-card-pin'
Vue.use(ScratchCard)

<vue-scratch-card-pin
    element-id='scratchWrap'
    :ratio=0.5
    :move-radius=50
/>

2.通过标签<script>引用

<vue-scratch-card-pin
    element-id='scratchWrap'
    :ratio=0.5
    :move-radius=50
    :start-callback=startCallback
    :clear-callback=clearCallback
    cover-color='#caa'
  />

<script src="./node_modules/vue/dist/vue.js"></script>
<script>
    new Vue({
      el : '#app',
      data () {
        return {

        }
      },
      methods : {
        startCallback(){
          console.log('抽奖成功!')
        },
        clearCallback(){
          console.log('清除完毕!')
        }
      }
    })
</script>

属性

可以向vue-scratch-card-pin组件传递的props值:

Name | Type | Default | Description ------------- | ------------- | ------------- | ------------- element-id | String| scratch | 可选,组件最外层DOM的id属性。如果页面中超多一次调用vue-scratch-card,必须传入该属性区分不同的刮刮卡组件 ratio | Number | 0.3 | 可选,要求刮掉的面积占比,达到这个占比后,将会自动把其余区域清除 start-callback | Function | | 可选,第一次触碰到刮刮卡的函数。比如可以在这个函数中调取抽奖接口 clear-callback | Function | | 可选,刮刮卡清除完毕后事件 cover-color | String | #C5C5C5 | 可选,刮刮卡遮罩层的颜色 cover-img | String | | 可选,刮刮卡遮罩层图片,图片格式必须为base64 resul-img | String | | 可选,刮刮卡结果区域的图片 move-radius | Number | | 可选,刮刮清除的半径

插槽

组件还可以定制结果区域的DOM结构,插槽名为result

<VueScratchCardPin>
    <div slot='result'>
        恭喜您中大奖啦~~
    </div>
</VueScratchCardPin>