vue-vote

1.0.9 • Public • Published

vue-vote

Description

A Vue.js component for creating polls, voting and showing results. It’s easy to implement and easy to customize. It`s based on vue2+

Install

npm i vue-vote

Usage

<template>
    <div id="app" class="container">
      <vue-vote v-bind="options" @addvote="addVote"></vue-vote>
    </div>
</template>

data(){
        return {
          options: {
            question: "Vote for your favorite NBA team",
            answers: [
              { value: 1, text: "Los Angeles Lakers", votes: 53 },
              { value: 2, text: "Houston Rockets", votes: 295 },
              { value: 3, text: "Minnesota Timberwolves", votes: 30 },
              { value: 4, text: "New York Knicks", votes: 10 }
            ]
          }
        }
    },
    methods: {
      addVote(obj) {
        console.log("You voted " + obj.value + "!");
      },
    }

The effect:

输入图片说明 输入图片说明 输入图片说明

Package Sidebar

Install

npm i vue-vote

Weekly Downloads

4

Version

1.0.9

License

ISC

Unpacked Size

10.7 kB

Total Files

5

Last publish

Collaborators

  • guonei001