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

@puckwang/vue-slot-machine

v0.0.12

Published

A Vue component of a slot machine, made with an HTML5 canvas, RWD.

Downloads

45

Readme

Vue-SlotMachine

Banner npm npm npm

A Vue component of a slot machine, made with an HTML5 canvas, RWD.

Table of Contents

Installation

In NPM

  1. Use npm or yarn download @puckwang/vue-slot-machine.
npm install @puckwang/vue-slot-machine

// or

yarn add @puckwang/vue-slot-machine
  1. Registered component. Then register the plugin to globally install all components:
import SlotMachine from '@puckwang/vue-slot-machine';

Vue.use(SlotMachine);

Or, import components individually for local registration:

import {SlotMachine} from '@puckwang/vue-slot-machine';

export default {
    components: { "slot-machine": SlotMachine }
}

In Browser

<div id="app">
    <div>
        <slot-machine></slot-machine>
    </div>
</div>

<script src="https://unpkg.com/@puckwang/vue-slot-machine@latest"></script>

<script>
var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue!'
  },
  components: { "slot-machine": VueSlotMachine.SlotMachine }
})
</script>

Usage

Demo

<template>
    <slot-machine
        :list="list"
        :trigger="trigger"
        :height="300"
        :width="300"
        @onComplete="onComplete">
    </slot-machine>
</template>

<script>
export default {
    data() {
        return {
            list: [
                {text: '1', color: '#668CFF'},
                {text: '2', color: '#FF6666'},
                {text: '3', color: '#B366FF'},
            ],
            trigger: null,
        };
    },
    methods: {
        start() { // Trigger to let the machine start
            this.trigger = new Date();
        },
        onComplete(data) { // Run complete callback
            console.log(data);
        }
    }
}
</script>

Configuration

Component props

list
  • Type: Object[]
  • Description: A list of gift object.
  • Default: 0~9
trigger
  • Type: Date
  • Description: Use to trigger to let the machine start.
  • Default: null
currentIndex
  • Type: Integer
  • Description: Specify the index the result.
  • Default: -1
width
  • Type: Date
  • Description: Width of canvas.
  • Default: 300
height
  • Type: Date
  • Description: Height of canvas.
  • Default: 300
responsive
  • Type: Boolean
  • Description: Responsive Canvas, width and height will be filled parent element, it's according to the set ratio (height / width).
  • Default: false

Gift Object

text
  • Type: String
  • Description: Text of the gift.
  • Required
color
  • Type: ColorHex
  • Description: Color for gift text.
  • Default: #000 (Black)
fontFamily
  • Type: String
  • Description: Font family for gift text.
  • Default: Arial
fontStyle
  • Type: String
  • Description: Font style for gift text. can be normal, bold, italic or even italic bold.
  • Default: normal
align
  • Type: String
  • Description: Text align for gift text. can be left, center, or right.
  • Default: center
verticalAlign
  • Type: String
  • Description: Text vertical align for gift text. can be top, middle or bottom.
  • Default: middle

Changing the fontFamily, fontStyle and verticalAlign will cause the layout to break! It is recommended to use the default value.

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.