/*
復制按鈕的實現
*/
copy(value) {
//提示模板
uni.showModal({
content: value, //模板中提示的內容
confirmText: '復制內容',
success: () => { //點擊復制內容的后調函數
//uni.setClipboardData方法就是講內容復制到粘貼板
// API `setClipboardData` is not yet implemented
//意思是H5端沒有這個接口!!!
uni.setClipboardData({
data: value, //要被復制的內容
success: function() {
//重點~做筆記
//在success中加入uni.hideToast()可以解決
uni.hideToast({
title: '復制成功',
duration: 2000,
icon: 'none'
});
//以下就可自定義操作了~
},
fail: function(err) {
uni.showToast({
title: '復制失敗',
duration: 2000,
icon: 'none'
});
}
});
}
});
}
這個報錯后續看看如何解決!!!下面可以解決
這個詳細的解答可以參考:https://blog.csdn.net/qq_40976321/article/details/107053434
很好的解答了
成功了,上面的文章解答是可以實現的