1.0.0 • Published 7 years ago
km-user-popover v1.0.0
用户名片组件
安装
npm install --save km-user-popover --registry http://10.240.171.10:4873
使用
import UserPopover from 'km-user-popover'
import 'km-user-popover/styles/css/style.css'
<UserPopover
requestUrl={`/ps/get_user_info_card?identifier=${author.identifier}`}
placement="top"
avatarUrl={`/zone/${author.identifier}`}
canFollow={author.identifier !== currentUser.identifier}>
<a href={`/zone/${author.identifier}`}>{author.name}</a>
</UserPopover>
主要参数
name | type | default | description |
---|---|---|---|
requestUrl | string | 数据请求URL | |
avatarUrl | string | 用户头像链接URL | |
canFollow | bool | 能否关注 | |
addFollowUrl | string | /follow/add | 关注接口URL |
cancelFollowUrl | string | /follow/cancel | 取消关注接口URL |
onFollowSuccess | function | 关注成功回调 | |
onFollowError | function | 关注失败回调 | |
trigger | string[] | 'hover' | 显示触发动作,可选'hover','click','focus' |
placement | string | bottom | 出现位置,可选'left','right','top','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight' |