Skip to content

Clipboard

setClipboardData

TIP

The API usage is as follows: wx.setClipboardData(Object object)

  • Functional description: Set the content of the system clipboard. For a single user, call no more than 1 time per second

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    datastring-YesClipboard content
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Sample code:

js
wx.setClipboardData({
  data: 'data',
  success(res) {
    wx.getClipboardData({
      success(res) {
        console.log(res.data) // data
      }
    })
  }
})

getClipboardData

TIP

The API usage is as follows: wx.getClipboardData(Object object)

  • Functional description: Get the content of the system clipboard. For a single user, call no more than 1 time per second

  • Parameters and descriptions: Object object。

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: Object Object。

    PropertiesTypeDescription
    datastringClipboard content
  • Sample code:

js
wx.getClipboardData({
  success(res) {
    console.log(res.data)
  }
})