WeChat Open Platform

Mini Programs Documentation

Clipboard

wx.setClipboardData(OBJECT)

Sets system clipboard content.

OBJECT parameter descriptions:

Parameter Type Required Description
data String Yes Content that needs to be set
success Function No Callback function for successful interface call
fail Function No Callback function for failed interface call
complete Function No Callback function for interface call results (will be executed if call succeeds or fails)

Sample code:

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

wx.getClipboardData(OBJECT)

Gets system clipboard content.

OBJECT parameter descriptions:

Parameter Type Required Description
success Function No Callback function for successful interface call
fail Function No Callback function for failed interface call
complete Function No Callback function for interface call results (will be executed if call succeeds or fails)

success return parameter descriptions:

Parameter Type Description
data String Clipboard content

Sample code:

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