An open API service indexing awesome lists of open source software.

https://github.com/fireyy/emoji-vote

Vote use emoji.
https://github.com/fireyy/emoji-vote

emoji vote

Last synced: 7 months ago
JSON representation

Vote use emoji.

Awesome Lists containing this project

README

          

# emoji-vote






Live Demo

> Emoji vote component.

- Idea from [支付宝商户评论页的满意度 Emoji 会跟随用户的当前选择看向该 Icon](http://uedetail.com/archives/3832).
- Emoji from [EmojiOne™ 2](https://emojitwo.github.io/).

## Install

This project uses [node](http://nodejs.org) and [npm](https://npmjs.com). Go check them out if you don't have them locally installed.

```sh
$ npm install --save emoji-vote
```

Then with a module bundler like [rollup](http://rollupjs.org/) or [webpack](https://webpack.js.org/), use as you would anything else:

```javascript
// using ES6 modules
import emojiVote from 'emoji-vote'

// using CommonJS modules
var emojiVote = require('emoji-vote')
```

The [UMD](https://github.com/umdjs/umd) build is also available on [unpkg](https://unpkg.com):

```html

```

This exposes the `emojiVote()` function as a global.

* * *

## Usage

```html



不满

一般

满意

满意

```

```js
import emojiVote from 'emoji-vote'

emojiVote('.emoji', {
size: 30
})
```

## Examples & Demos

[**Real Example on JSFiddle**](https://jsfiddle.net/fireyy/q1c2zcya/) ➡️

## API

emoji-vote's API is organized as follows:

### `emojiVote(el: String|Element, options: Object)`

emojiVote will account for the following properties in options:

* `emoji` The emoji data array, default:

```js
[
`



`,
`



`,
...
]
```

* `render` The render function for create svg, default:

```js
function (data, size) {
return `



${data}


`
}
```

* `size` The emoji size, default to `20px`.

## TODO

- [x] custom emoji svg template.
- [ ] custom emoji color config