快应用 剪贴板
2020-08-10 14:34 更新
接口声明
{"name": "system.clipboard"}
导入模块
import clipboard from '@system.clipboard'或 const clipboard = require('@system.clipboard')
接口定义
clipboard.set(OBJECT)
修改剪贴板内容
参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | String | 是 | 需要放到剪切板的内容 |
| success | Function | 否 | 成功回调 |
| fail | Function | 否 | 失败回调 |
| complete | Function | 否 | 执行结束后的回调 |
示例:
clipboard.set({
text: 'text'
})
clipboard.get(OBJECT)
读取剪贴板内容
参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | Function | 否 | 成功回调 |
| fail | Function | 否 | 失败回调 |
| complete | Function | 否 | 执行结束后的回调 |
success返回值:
| 参数名 | 类型 | 说明 |
|---|---|---|
| text | String | 剪切板内容 |
示例:
clipboard.get({
success: function (data) {
console.log(`handling success: ${data.text}`)
},
fail: function (data, code) {
console.log(`handling fail, code = ${code}`)
}
})
后台运行限制
禁止使用。
后台运行详细用法参见 后台运行脚本。
以上内容是否对您有帮助:
← 快应用 传感器

免费 AI IDE


更多建议: