Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uni/clipboard

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uni/clipboard

[![npm](https://img.shields.io/npm/v/@uni/clipboard.svg)](https://www.npmjs.com/package/@uni/clipboard)

  • 1.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
355
decreased by-51.77%
Maintainers
2
Weekly downloads
 
Created
Source

getClipboard

npm

安装

$ npm install @uni/clipboard --save

or

$ npm install @uni/apis --save

示例

import { getClipboard } from '@uni/clipboard';

getClipboard({
  success (res){
    console.log(res.text);
  }
});

// promise
getClipboard().then(res => {
  console.log(res.text);
});

方法

getClipboard()

获取系统剪贴板的内容

支持

miniApp wechatMiniprogram bytedanceMicroApp baiduSmartProgram kuaiShouMiniProgram

h5 暂不支持此方法

参数
成员类型描述必选默认值
optionsobject ✔️-
options.successFunction 成功的回调-
options.failFunction 失败的回调-
options.completeFunction 结束的回调 (调用成功、失败都会执行)-
返回
成员类型描述
resobject
res.textstring剪贴板的内容

setClipboard

设置系统剪贴板的内容。

支持

browser miniApp wechatMiniprogram bytedanceMicroApp baiduSmartProgram kuaiShouMiniProgram

示例
import { setClipboard } from '@uni/clipboard';

setClipboard({
  text: 'text',
  success (res){
    console.log(res);
  }
});

// promise
setClipboard({
  text: 'text'
}).then(res => {
  console.log(res);
});

参数
成员类型描述必选默认值
optionsobject ✔️-
options.textstring 剪切板数据✔️-
options.successFunction 成功的回调-
options.failFunction 失败的回调-
options.completeFunction 结束的回调 (调用成功、失败都会执行)-

FAQs

Package last updated on 07 Sep 2022

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