New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bee-clipboard

Package Overview
Dependencies
Maintainers
15
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bee-clipboard

Clipboard ui component for react

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
decreased by-39.76%
Maintainers
15
Weekly downloads
 
Created
Source

bee-clipboard

npm version Build Status Coverage Status devDependency Status NPM downloads Average time to resolve an issue Percentage of issues still open

基于clipboard.js封装的复制组件

react bee-clipboard component for tinper-bee

复制组件

Browser Support

Chrome logoEdge logoFirefox logoInternet Explorer logoOpera logoSafari logo
42+ ✔12+ ✔41+ ✔9+ ✔29+ ✔10+ ✔

使用方法

import Clipboard from 'bee-clipboard';

class ClipboardDemo extends Component {
    render() {
        function success() {
            console.log('success');
        }

        function error() {
            console.log('error');
        }

        return (
            <Clipboard action="copy" text="我将被复制到剪切板" success={success} error={error}>

            </Clipboard>
        )
    }
}
样式引入
  • 可以使用link引入build目录下Clipboard.css
<link rel="stylesheet" href="./node_modules/bee-clipboard/build/Clipboard.css">
  • 可以在js中import样式
import "./node_modules/bee-clipboard/src/Clipboard.scss"
//或是
import "./node_modules/bee-clipboard/build/Clipboard.css"

API

参数说明类型默认值
action方法,可以传copy或者cut,cut只支持textareastringcopy
text要复制的文本内容string-
target要复制内容的目标元素,可传选择器,如果选择器得出多个,会取第一个string/dom选择器-
success复制成功之后的回调函数function-
error复制失败之后的回调函数function-
locale设置默认文字语言object中文

多语设置

通过给Clipboard组件设置locale语言对象。

如:

export default {
    lang: 'zh-cn',
    copy: '复制',
    cut: '剪切',
    copyReady: '已复制',
    cutReady: '已剪切'
}

组件内默认中文,提供英文包。

import en from 'bee-clipboard/build/en_US.js';
开发调试
$ npm install -g bee-tools
$ git clone https://github.com/tinper-bee/bee-clipboard
$ cd bee-clipboard
$ npm install
$ npm run dev

Keywords

FAQs

Package last updated on 15 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc