Socket
Socket
Sign inDemoInstall

@uni/clipboard

Package Overview
Dependencies
1
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

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)


Version published
Weekly downloads
591
decreased by-1.99%
Maintainers
2
Install size
195 kB
Created
Weekly downloads
 

Readme

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

Last updated on 07 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc