vuejs组件, 炫酷的按钮点击效果, 让你的

demo.gif

vuejs实现的一个类似Medium的按钮点击效果. 同样Github上还有一个react实现的版本, 点击 react-clap-button

点击立即预览: https://jsbin.com/kapomaw/edit?html,output
Github源码地址 : https://github.com/AJLoveChina/vue-clap-button

非常简洁干净的API设计, 并且接口丰富, 能够完成大多数开发场景. 如果有BUG 欢迎提交issue😂

下面是开发文档

Install

The recommended way is using npm

npm install vue-clap-button --save 

Also you can insert script tag in your html file after vue script

<script src="dist/vue-clap-button.js"></script>

Usage

In your entry script

import Vue from 'vue'
import vueClapButton from 'vue-clap-button'
Vue.use(vueClapButton);

Then in your .vue file

<vue-clap-button />

It is done! Really simple to use ? Yes ❤

Want a complex example ? see following guide

Attributes

parameter description type enum value default value
icon specify a icon String good, star, love good
size change the size of icon, in pixel Number - 50
maxClick How many times can I love/like it? Number - 1
bgColor background color of icon String - #FFF
colorActive color for icon with claps String - #F56C6C
colorNormal normal or initial color for icon without claps String - #909399

Events

event name description callback parameter
cancel user cancel all claps on it -
clap user give one love on it total claps given now (type : number)

Methods

method name description return value
getClaps get total claps type:Number

License

MIT

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    wgl0419阅读 6,341评论 1 9
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,509评论 2 45
  • 机器学习的定义(Machine Learning Definition) Even among machine l...
    SmallRookie阅读 896评论 0 0
  • 善待别人,就是善待自己
    树叶的恋曲阅读 125评论 0 0
  • 为了我的梦 追寻自己的价值 我来了 道路虽崎岖坎坷 但我不会放弃 因为我相信 不忘初心,方得始终 追梦 毕生的追求...
    闲垂散人阅读 215评论 2 1