npm

Need private packages and team management tools?Check out npm Orgs. »

react-to-copy

0.1.1 • Public • Published

react-to-copy

移动端js实现点击复制到剪贴板,兼容市面上大多数浏览器。
基于https://www.love85g.com/?p=1528实现。

Usage

1:安装

npm install react-to-copy --save
or
yarn add react-to-copy

2:引入

import { Copy } from 'react-to-copy'

3:使用

<Copy />

API

<Copy 
    content = { content } 
    style = { style }
    btnText = { btnText }
    className = { className }
    callback = { callback }
    />

content
[String]
必填,需要复制的内容,不填写报错:Uncaught Error: Please configure the [content] of the component.

style
[Object]
非必填,自定义内联样式,参考react内联样式写法

btnText
[String]
非必填,复制按钮文字,默认为:Copy

className
[String]
非必填,自定义class名,定义复制按钮的样式,默认为:default-copy

callback
[Function]
非必填,复制成功的回调函数,常用于复制成功提示

install

npm i react-to-copy

Downloadsweekly downloads

9

version

0.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability