{"id":13810589,"url":"https://github.com/ppietris/vue-poll","last_synced_at":"2025-10-08T13:39:25.153Z","repository":{"id":32385014,"uuid":"132422823","full_name":"ppietris/vue-poll","owner":"ppietris","description":"A Vue.js component for voting","archived":false,"fork":false,"pushed_at":"2024-10-22T08:48:15.000Z","size":89,"stargazers_count":133,"open_issues_count":1,"forks_count":26,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T07:56:08.311Z","etag":null,"topics":["poll","vote","voting","vue","vuejs","vuejs2"],"latest_commit_sha":null,"homepage":"https://ppietris.github.io/vue-poll/index.html","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppietris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-07T07:23:35.000Z","updated_at":"2024-12-03T08:30:37.000Z","dependencies_parsed_at":"2022-08-07T17:15:59.175Z","dependency_job_id":null,"html_url":"https://github.com/ppietris/vue-poll","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppietris%2Fvue-poll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppietris%2Fvue-poll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppietris%2Fvue-poll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppietris%2Fvue-poll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppietris","download_url":"https://codeload.github.com/ppietris/vue-poll/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251785942,"owners_count":21643583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["poll","vote","voting","vue","vuejs","vuejs2"],"created_at":"2024-08-04T02:01:01.359Z","updated_at":"2025-10-08T13:39:20.115Z","avatar_url":"https://github.com/ppietris.png","language":"Vue","funding_links":[],"categories":["Vue","UI组件","Components \u0026 Libraries","UI Components","UI Components [🔝](#readme)"],"sub_categories":["形成","UI Components","Form"],"readme":"# Vue-poll\n\nA Twitter-like vote component, made with Vue.js 2\n\n[DEMO](https://ppietris.github.io/vue-poll/index.html)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/ppietris/vue-poll/blob/master/vue-poll-example.jpg?raw=true\" alt=\"Vue-poll example image\"/\u003e\n\u003c/p\u003e\n\n## Prerequisites\n- [Vue.js 2](https://vuejs.org/)\n\n## Installing\n\nUsing npm:\n\n```bash\n$ npm install vue-poll\n```\n\nUsing cdn:\n\n```html\n\u003cscript src=\"https://unpkg.com/vue-poll/dist/vue-poll.min.js\"\u003e\u003c/script\u003e\n```\n\n\n\n### Example (NPM)\n\nDefine `vue-poll` component markup inside your custom component.\n\nFor example in your `my-poll.vue`:\n\n```html\n\u003ctemplate\u003e\n    \u003cdiv\u003e\n        \u003cvue-poll v-bind=\"options\" @addvote=\"addVote\"/\u003e\n    \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e \n    \n    import VuePoll from 'vue-poll'\n    \n    export default {        \n        data() {\n            return {\n                options: {\n                    question: 'What\\'s your favourite \u003cstrong\u003eJS\u003c/strong\u003e framework?',\n                    answers: [\n                        { value: 1, text: 'Vue', votes: 53 },\n                        { value: 2, text: 'React', votes: 35 },\n                        { value: 3, text: 'Angular', votes: 30 },\n                        { value: 4, text: 'Other', votes: 10 } \n                    ]\n                }\n            }\n        },\n        components: {\n            VuePoll\n        },\n        methods: {\n            addVote(obj){\n                console.log('You voted ' + obj.value + '!');\n            }\n        }\n    }\n\u003c/script\u003e\n```\n### Example (CDN)\n\n```html\n\u003cbody\u003e\n    \u003cdiv id=\"app\"\u003e\n        \u003cvue-poll v-bind=\"options\" @addvote=\"addVote\"/\u003e\n    \u003c/div\u003e\n\n    \u003cscript src=\"https://unpkg.com/vue-poll/dist/vue-poll.min.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e \n\n        Vue.use(VuePoll);\n\n        new Vue({\n            el: '#app'\n            data: function() {\n                return {\n                    options: {\n                        question: 'What\\'s your favourite \u003cstrong\u003eJS\u003c/strong\u003e framework?',\n                        answers: [\n                            { value: 1, text: 'Vue', votes: 53 },\n                            { value: 2, text: 'React', votes: 35 },\n                            { value: 3, text: 'Angular', votes: 30 },\n                            { value: 4, text: 'Other', votes: 10 } \n                        ]\n                    }\n                }\n            },\n            methods: {\n                addVote: function(obj){\n                    console.log('You voted ' + obj.value + '!');\n                }\n            }\n        });\n    \u003c/script\u003e\n\u003c/body\u003e\n```\n## Options\n\n- #### question (required) (string-html)\n  The question of the poll. \n\n- #### answers (required) (array)\n  An array of the answers of the poll. \n\n  **value (required) (integer)**\n  A unique value for each answer\n  \n  **text (required) (string-html)**\n  Answer's text\n  \n  **votes (required) (integer)**\n  Answer's votes\n  \n  **selected (required when multiple is true) (boolean)**\n  Selected state of the answer\n  \n  **custom_class (optional) (string)**\n  Custom css class for the answer element\n\n\n- #### showResults (optional) (boolean) (default: false)\n  Set this to true to skip the voting and show the results of the poll\n  \n- #### finalResults (optional) (boolean) (default: false)\n  Set this to true to skip the voting and show the results of the poll. Winner will be highlighted\n\n- #### multiple (optional) (boolean) (default: false)\n  Set this to true for multiple voting\n  \n- #### submitButtonText (optional) (string) (default: Submit)\n  Text of the multiple voting submit button\n\n- #### customId (optional) (number)\n  A custom id that will be returned on the addvote method\n\n## Methods\n\n- #### addvote (returns object)\n  Callback on add vote. It returns an object that includes: answer's value, answer's votes, total poll's votes and the custom id \n\n## License\nMIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppietris%2Fvue-poll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppietris%2Fvue-poll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppietris%2Fvue-poll/lists"}