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 🙏

© 2026 – Pkg Stats / Ryan Hefner

lucky-wheel-component

v1.0.2

Published

A lucky wheel component for Vue 3 and React

Readme

抽奖转盘游戏组件

English | 简体中文

一个精心设计的幸运转盘抽奖游戏,基于现代 Web 技术构建,提供流畅的动画效果和完整的抽奖体验。支持自定义奖品配置、动态修改转盘样式,支持 Vue2/Vue 3 和 React。

特别适合:

  • 营销活动和用户促活
  • 会员奖励系统
  • 游戏互动场景
  • 节日活动抽奖

预览

动画效果

转盘动画

不同奖品数量效果

6个奖品样式:

6个奖品

8个奖品样式:

8个奖品

功能特点

  • 流畅的转盘动画效果
  • 支持自定义奖品配置
  • 加载动画提示

技术特性

  • 支持 Vue2/Vue 3 和 React
  • TypeScript 支持
  • 可自定义奖品、颜色和旋转效果
  • 响应式设计
  • 完整的事件回调

安装

npm install lucky-wheel-component

使用方法

安装

npm install lucky-wheel-component

使用方法

Vue 引入

// 默认导入 Vue 版本
import { LuckyWheel } from 'lucky-wheel-component';

// 或明确指定 Vue3 版本
import { LuckyWheel } from 'lucky-wheel-component/vue3';

React引入

// 导入 React 版本
import { LuckyWheel } from 'lucky-wheel-component/react';

Vue 2

<template>
  <LuckyWheel 
    :prizes="prizes"
    :initialDrawCount="3"
    :additionalTurns="10"
    @on-start="handleStart"
    @on-complete="handleComplete"
  />
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { LuckyWheel } from 'lucky-wheel-component'

export default defineComponent({
  components: {
    LuckyWheel
  },
  data() {
    return {
      prizes: [
        { title: '恭喜获得', prize: '一等奖' },
        { title: '恭喜获得', prize: '二等奖' },
        // ...更多奖品
      ]
    }
  },
  methods: {
    handleStart({ prizeIndex, drawCount }) {
      console.log('开始抽奖', prizeIndex, drawCount)
    },
    handleComplete({ index, prize }) {
      console.log('抽奖完成', index, prize)
    }
  }
})
</script>

Vue 3 Composition API

<template>
  <LuckyWheel 
    :prizes="prizes"
    :initialDrawCount="3"
    @on-start="handleStart"
    @on-complete="handleComplete"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { LuckyWheel } from 'lucky-wheel-component/vue3'

const prizes = ref([
  { title: '恭喜获得', prize: '一等奖' },
  { title: '恭喜获得', prize: '二等奖' },
  // ... 更多奖品
])

const handleStart = ({ prizeIndex, drawCount }) => {
  console.log('开始抽奖', prizeIndex, drawCount)
}

const handleComplete = ({ index, prize }) => {
  console.log('抽奖完成', index, prize)
}
</script>

React

import React from 'react';
import { LuckyWheel } from 'lucky-wheel-component/react';

const App: React.FC = () => {
  const prizes = [
    { title: '恭喜获得', prize: '一等奖' },
    { title: '恭喜获得', prize: '二等奖' },
    // ...更多奖品
  ];

  const handleStart = ({ prizeIndex, drawCount }) => {
    console.log('开始抽奖', prizeIndex, drawCount);
  };

  const handleComplete = ({ index, prize }) => {
    console.log('抽奖完成', index, prize);
  };

  return (
    <LuckyWheel 
      prizes={prizes}
      initialDrawCount={3}
      additionalTurns={10}
      onStart={handleStart}
      onComplete={handleComplete}
    />
  );
};

API

Props

| 属性 | 类型 | 默认值 | 说明 | |------|------|--------|------| | prizes | Prize[] | [] | 奖品列表 | | initialDrawCount | number | 3 | 初始抽奖次数 | | additionalTurns | number | 10 | 额外旋转圈数 | | colors | string[] | ['#f31f49', '#fff7d7', '#a71d77'] | 奖品区块背景色 | | textColors | string[] | ['#f3f1f1', '#a8213c', '#f3f1f1'] | 奖品文字颜色 |

Events

| 事件名 | 参数 | 说明 | |--------|------|------| | onStart/on-start | { prizeIndex: number, drawCount: number } | 开始抽奖时触发 | | onComplete/on-complete | { index: number, prize: Prize } | 抽奖完成时触发 |

Prize 类型

interface Prize {
  title: string;  // 奖品标题
  prize: string;  // 奖品内容
}

开发

# 安装依赖
npm install

# 运行 Vue 示例
npm run dev:vue

# 运行 React 示例
npm run dev:react

# 构建
npm run build

License

MIT

Links