设置剪贴板文本数据
同步接口支持版本:iOS >= 6.3.0
Android >= 6.3.0
参数名 | 类型 | 是否可选 | 默认值 | 含义 |
---|---|---|---|---|
options text |
Object String |
选项 或 要存入剪贴板的文本 | ||
options.query |
Object |
请求参数 | ||
options.query.text |
String |
要存入剪贴板的文本 | ||
options.success |
Function |
可选 | 调用成功的回调函数 | |
options.error |
Function |
可选 | 调用失败的回调函数 | |
callback |
Function |
可选 | 调用成功的回调函数 |
参数名 | 类型 | 是否一定返回 | 含义 |
---|---|---|---|
result |
Object |
响应对象 | |
result.code |
String |
错误码 | |
result.msg |
String |
错误信息 |
QN.clipboard.setText('文本内容');
// 异步调用 QN.clipboard.setText('文本内容', (result) => { console.log(result); }) // 同步调用 let result = QN.clipboard.setTextSync('文本内容'); console.log(result);
QN.clipboard.setText('文本内容') .then((result) => { console.log(result); }, (error) => { console.log(error); });
// 入参为:options QN.clipboard.setText({ query: {text: '文本内容'}, success(result) { console.log(result); }, error(error) { console.log(error); } });
获取剪贴板文本数据
同步接口支持版本:iOS >= 6.3.0
Android >= 6.3.0
参数名 | 类型 | 是否可选 | 默认值 | 含义 |
---|---|---|---|---|
options callback |
Object Function |
选项 或 调用成功的回调函数 | ||
options.success |
Function |
可选 | 调用成功的回调函数 | |
options.error |
Function |
可选 | 调用失败的回调函数 |
参数名 | 类型 | 是否一定返回 | 含义 |
---|---|---|---|
result |
Object |
响应对象 | |
result.data |
String |
剪贴板数据内容 | |
result.code |
String |
错误码 | |
result.msg |
String |
错误信息 |
// 异步调用 QN.clipboard.getText(result => { console.log(result); }); // 同步调用 let result = QN.clipboard.getTextSync(); console.log(result);
QN.clipboard.getText() .then((result) => { console.log(result); }, (error) => { console.log(error); });
QN.clipboard.getText({ success(result) { console.log(result); }, error(error) { console.log(error); } });