原因:
QQ不支持網路圖片地址,需要給api傳本地圖片地址,是file///:開頭的路徑,具體可以參考5+的地址轉換方法
requestFileSystem: 請求本地文件系統對象
resolveLocalFileSystemURL: 通過URL參數獲取目錄對象或文件對象
convertLocalFileSystemURL: 將本地URL路徑轉換成平台絕對路徑
convertAbsoluteFileSystem: 將平台絕對路徑轉換成本地URL路徑
if (a == 'qq') { $(function() { mui.plusReady(function() { console.log(' mui.plusReady執行了') // plus.io.resolveLocalFileSystemURL('_www/static/img/android.png', function(entry) {//安卓 plus.io.resolveLocalFileSystemURL('_www/static/img/ios.png', function(entry) {//ios let pictures = []; var dirReader = entry.toLocalURL(); pictures.push(dirReader); console.log(pictures,'絕對路徑') let qq_msg = { type: 'image', //分享的內容的類型 pictures:pictures, } plus.nativeUI.actionSheet({ title: '分享圖片到QQ', cancel: '取消', buttons: _this.buttons1, }, function(e) { (e.index > 0) && _this.sharePage(_this.sqq, qq_msg, _this.buttons[e.index - 1]); }) }, function(e) { alert('路徑或文件不存在') }); }) }) }