All Projects → ppietris → Vue Poll

ppietris / Vue Poll

A Vue.js component for voting

Projects that are alternatives of or similar to Vue Poll

Gh Polls
These polls work by pasting individual markdown SVG images into your issue, each wrapped with a link that tracks a vote. A single vote per IP is allowed for a given poll, which are stored in DynamoDB.
Stars: ✭ 1,726 (+1400.87%)
Mutual labels:  voting, vote
rater-js
Star rating widget for the browser. Unlimited number of stars. No dependencies. No Jquery required.
Stars: ✭ 66 (-42.61%)
Mutual labels:  voting, vote
Simple Vote
SimpleVote - An open-source, live updating, voting platform based on range voting.
Stars: ✭ 150 (+30.43%)
Mutual labels:  voting, vote
yii2-vote
Provides voting for any model 👍 👎
Stars: ✭ 70 (-39.13%)
Mutual labels:  voting, vote
Raty
🌟 Raty - A Star Rating Plugin
Stars: ✭ 2,292 (+1893.04%)
Mutual labels:  voting, vote
easypoll-v3
EasyPoll Discord Bot | With EasyPoll, a Discord Poll Bot, you can easily create polls and your members can vote by clicking on a reaction very easily and quickly.
Stars: ✭ 35 (-69.57%)
Mutual labels:  voting, vote
Pd Select
vue components ,like ios 3D picker style,vue 3d 选择器组件,3D滚轮
Stars: ✭ 101 (-12.17%)
Mutual labels:  vuejs2
Vue Laravel Spa
Single Page Application made with Vue.JS2, Vue Router, Vuex and Laravel 5.6.
Stars: ✭ 107 (-6.96%)
Mutual labels:  vuejs2
Vue Mall
🔨 基于 vue+node+mongodb 实现一个锤子商城
Stars: ✭ 1,367 (+1088.7%)
Mutual labels:  vuejs2
Vuejs Calendar
Source code for Build A Professional Vue App with Vuex & Server-Side Rendering
Stars: ✭ 100 (-13.04%)
Mutual labels:  vuejs2
Vue Pdf
vue.js pdf viewer
Stars: ✭ 1,700 (+1378.26%)
Mutual labels:  vuejs2
Vue Generator
A CLI generator for Vue components, views and store modules
Stars: ✭ 111 (-3.48%)
Mutual labels:  vuejs2
Vue Places
Places component is based on places.js for Vue 2.x. Turn any <input> into an address autocomplete.
Stars: ✭ 106 (-7.83%)
Mutual labels:  vuejs2
Vuejs Cinema
Source code for the case-study project from the course Build A Vue.js Single-Page App with Vue Router
Stars: ✭ 101 (-12.17%)
Mutual labels:  vuejs2
Vue Gmaps
Search places and address using Google Maps API
Stars: ✭ 108 (-6.09%)
Mutual labels:  vuejs2
Vue Ellipse Progress
A Vue.js component to create beautiful animated circular progress bars
Stars: ✭ 101 (-12.17%)
Mutual labels:  vuejs2
Vue Highcharts
The Component of Vue 2.x for highcharts
Stars: ✭ 112 (-2.61%)
Mutual labels:  vuejs2
Votr
🌟 A polling application built with Flask and React
Stars: ✭ 100 (-13.04%)
Mutual labels:  voting
Vue Clazy Load
Component-based lazy (CLazy) load images in Vue.js 2
Stars: ✭ 106 (-7.83%)
Mutual labels:  vuejs2
Vue Mobx
😄 ⭐️ 😇 Mobx binding for Vuejs 2.
Stars: ✭ 111 (-3.48%)
Mutual labels:  vuejs2

Vue-poll

A Twitter-like vote component, made with Vue.js 2

DEMO

Vue-poll example image

Prerequisites

Installing

Using npm:

$ npm install vue-poll

Using cdn:

<script src="https://unpkg.com/vue-poll/dist/vue-poll.min.js"></script>

Example (NPM)

Define vue-poll component markup inside your custom component.

For example in your my-poll.vue:

<template>
    <div>
        <vue-poll v-bind="options" @addvote="addVote"/>
    </div>
</template>

<script> 
    
    import VuePoll from 'vue-poll'
    
    export default {        
        data() {
            return {
                options: {
                    question: 'What\'s your favourite <strong>JS</strong> framework?',
                    answers: [
                        { value: 1, text: 'Vue', votes: 53 },
                        { value: 2, text: 'React', votes: 35 },
                        { value: 3, text: 'Angular', votes: 30 },
                        { value: 4, text: 'Other', votes: 10 } 
                    ]
                }
            }
        },
        components: {
            VuePoll
        },
        methods: {
            addVote(obj){
                console.log('You voted ' + obj.value + '!');
            }
        }
    }
</script>

Example (CDN)

<body>
    <div id="app">
        <vue-poll v-bind="options" @addvote="addVote"/>
    </div>

    <script src="https://unpkg.com/vue-poll/dist/vue-poll.min.js"></script>
    <script> 

        Vue.use(VuePoll);

        new Vue({
            el: '#app'
            data: function() {
                return {
                    options: {
                        question: 'What\'s your favourite <strong>JS</strong> framework?',
                        answers: [
                            { value: 1, text: 'Vue', votes: 53 },
                            { value: 2, text: 'React', votes: 35 },
                            { value: 3, text: 'Angular', votes: 30 },
                            { value: 4, text: 'Other', votes: 10 } 
                        ]
                    }
                }
            },
            methods: {
                addVote: function(obj){
                    console.log('You voted ' + obj.value + '!');
                }
            }
        });
    </script>
</body>

Options

  • question (required) (string-html)

    The question of the poll.

  • answers (required) (array)

    An array of the answers of the poll.

    value (required) (integer) A unique value for each answer

    text (required) (string-html) Answer's text

    votes (required) (integer) Answer's votes

    selected (required when multiple is true) (boolean) Selected state of the answer

    custom_class (optional) (string) Custom css class for the answer element

  • showResults (optional) (boolean) (default: false)

    Set this to true to skip the voting and show the results of the poll

  • finalResults (optional) (boolean) (default: false)

    Set this to true to skip the voting and show the results of the poll. Winner will be highlighted

  • multiple (optional) (boolean) (default: false)

    Set this to true for multiple voting

  • submitButtonText (optional) (string) (default: Submit)

    Text of the multiple voting submit button

  • customId (optional) (number)

    A custom id that will be returned on the addvote method

Methods

  • addvote (returns object)

    Callback on add vote. It returns an object that includes: answer's value, answer's votes, total poll's votes and the custom id

License

MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].