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-prize

v1.1.6

Published

vue-抽奖组件

Downloads

6

Readme

vue-prize

vue-抽奖组件

vue-prize

vue-prize是基于Vue和canvas组件。

Installation

Using yarn:

yarn add vue-prize

Using npm:

npm i prize

快速上手

引入vue-prize

// 引入vue-prize
import prize from 'vue-prize';
new Vue({
  el: 'root',
  components: {
    prize
  }
})

Example

<template>
<div class="appBox">
  <div class="app">
    <prize :data="data"/>
  </div>
</div>
</template>

<script>
import prize from 'vue-prize'
export default {
  name: 'App',
  data () {
    return {
      data: {
        type: 2,
        notClick: true,
        endEvent: this.endBack,
        reword: [{prize: '一等奖', content: '奔驰', PR: 0.1},{prize: '谢谢参与', content: '感谢参与', PR: 0.1}, {prize: '二等奖', content: '宝 马', PR: 0.1},          
        {prize: '谢谢参与',content: '感谢参与', PR: 0.1}, {prize: '开始抽奖'},  {prize: '三等奖',content: '奔驰',  PR: 0.1}, {prize: '谢谢参与', content: '感谢参与', PR: 0.1},  
        {prize: '特等奖', content: '奔驰+宝马', PR: 0.1},  {prize: '谢谢参与', content: '感谢参与', PR: 0.1}],
        square: {
          unitStyle: 'font-size: 20px; text-align: center; background: #448aff; color: #bbdefb;',
          speed: 50,
          startRewordStyle: 'font-size: 30px; text-align: center; background: #03a9f4',
          itemStyle: 'background:  #212121!important'
        },
        round: {
          height: 500,
          width: 500,
          brgColor: {
            bigOne: '#303f9f',
            bigTwo: '#c5cae9',
            small: '#3f51b5'
          }
        }
      }
    }
  },
  components: {
    prize
  },
  methods: {
    endBack (data) {
      const [info, row] = data
      alert(info.prize)
    }
  }
}
</script>

<style>
.appBox{}
.app{
  height: 500px;
  width: 500px;
}
</style>

使用

Props

| 名称 | 类型 | 默认 | 说明 | | ----------------| ---------------- | ---------------| ------------------------------------------| | data | Object | {} | 对象数据 | | data.type | Number | 1 | 奖盘类型 (1 or 2) | | data.notClick | Boolean | true | 控制奖盘是否可以点击抽奖| | data.endEvent | Function | null | 抽奖结束后的事件 参数 {data} (let [info, row] = data) | | data.reword | Object | [{prize: '', PR: 0.1, content: ''}] | 奖品{prize} - 概率{PR} - 描述{content} (参考Example)| | data.square | Object | {unitStyle: '', speed: 50, startRewordStyle: '', itemStyle: ''} | 方格样式{unitStyle} - 速度{speed} - 点击开始样式{startRewordStyle} - 跳动方格样式{itemStyle} (参考Example) | | data.round | Object | 圆形抽奖组件样式 { height: 500, width: 500, brgColor: {bigOne: '#303f9f', bigTwo: '#c5cae9', small: '#3f51b5'}} | 画布高度{height} - 画布宽度{width} - 组件样式颜色{brgColor} (参考Example) |