👊 An easier fortune-wheel in Vue.js 👊
🔥 Vue3 + Typescript 🔥
Open this link on a new tab
Install the package:
npm install vue3-fortune-wheel --save
yarn add vue3-fortune-wheel
import { Wheel } from 'vue3-fortune-wheel'
export default {
components: {
Wheel,
},
}
<Wheel />
Number
null
This data corresponds to the id of your winning object. In my case an API returns me the id. If you are not in this case you can create a method that randomly chooses an id
Exemple of this method
randomGift() {
return Math.floor(Math.random() * this.data.lengh) + 1
}
Number
5000
How many millisecondes you want the wheel to turn
Type: Array
Default: []
id: number
value: string
color: string
bgColor: string
data: [
{
id: 1,
value: "Gift 1",
color: '#7d7db3',
bgColor: '#ffffff'
},
{
id: 2,
value: "Gift 2",
color: '#ffffff',
bgColor: '#ffffff'
},
{
id: 3,
value: "Gift 3",
color: '#c92729',
bgColor: '#ffffff'
},
],
Object
{}
Possible to add an image in the center
{
src: string
width: number
height: number
}
Author: joffreyBerrier
Download Link: Download The Source Code
Official Website: https://github.com/joffreyBerrier/vue-fortune-wheel
License: MIT
#vue #vuejs