# wx.setClipboardData(Object object)
Start from base library version 1.1.0. Please remaining backward compatible.
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6
Sets the contents of the system clipboard. When called successfully, it pops up toast Cue "Content copied "Continue 1.5s
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
data | string | yes | Clipboard content | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# sample code
wx.setClipboardData({
data: 'data',
success (res) {
wx.getClipboardData({
success (res) {
console.log(res.data) // data
}
})
}
})