Git Product home page Git Product logo

zqh404 / vue-luck-draw Goto Github PK

View Code? Open in Web Editor NEW

This project forked from buuing/lucky-canvas

0.0 1.0 0.0 3.43 MB

🎉一个支持 vue2 / vue3 的(大转盘抽奖 / 九宫格抽奖)luckydraw 插件,🎨奖品 / 文字 / 图片 / 颜色 / 按钮均可配置,支持同步 / 异步抽奖,🏅概率前 / 后端可控,可根据 dpr 自动调整清晰度适配移动端,😇同时欢迎各位小伙伴提 pr 对代码进行优化

Home Page: https://100px.net?vue-luck-draw

License: BSD 3-Clause "New" or "Revised" License

Vue 8.86% JavaScript 91.14%

vue-luck-draw's Introduction

vue-luck-draw 抽奖插件

一个基于vue的 ( 大转盘 / 九宫格 ) canvas 插件

简体中文


官方文档 & Demo演示

https://100px.net?vue-luck-draw


在 vue2.x / vue3.x 中使用

方式 1:通过 import 引入

  1. 首先安装包

npm 安装:npm i vue-luck-draw
yarn 安装:yarn add vue-luck-draw

  1. 然后找到 main.js 引入插件并 use
// vue2.x
import LuckDraw from 'vue-luck-draw'
Vue.use(LuckDraw)

// vue3.x
import LuckDraw from 'vue-luck-draw/vue3'
createApp(App).use(LuckDraw).mount('#app')
  1. 最后在组件内使用 <LuckyWheel />大转盘组件<LuckyGrid />九宫格组件
<template>
  <div>
    <!-- 大转盘抽奖 -->
    <LuckyWheel
      style="width: 200px; height: 200px"
      ...你的配置
    />
    <!-- 九宫格抽奖 -->
    <LuckyGrid
      style="width: 200px; height: 200px"
      ...你的配置
    />
  </div>
</template>

方式 2:通过 script 标签引入

从下面的链接里下载一个叫luckdraw.umd.min.js的 js 文件, 然后使用 script 标签引入

<div id="app">
  <!-- 大转盘抽奖 -->
  <lucky-wheel
    style="width: 200px; height: 200px"
    ...你的配置
  />
  <!-- 九宫格抽奖 -->
  <lucky-grid
    style="width: 200px; height: 200px"
    ...你的配置
  />
</div>
<script src="./vue.min.js"></script>
<script src="./luckdraw.umd.min.js"></script>
<script>
  new Vue({
    el: '#app'
  })
</script>

vue-luck-draw's People

Contributors

buuing avatar luck-draw avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.