咱們在開發手機端程序的時候了,咱們常常須要使用到拍照,二維碼的功能.數字天堂公司提供了大量的原生API支持。html
http://www.html5plus.org/doc/vue
實現1.在hbuilder 選擇須要使用的模塊html5
2.在組件代碼中調用相應的API接口。app
好比拍照:ide
takePhoto(){ var _self=this; var cmr = plus.camera.getCamera(); var fmt = cmr.supportedImageFormats[0]; cmr.captureImage( function( path ){ plus.io.resolveLocalFileSystemURL(path, function(entry) { var tmpPath= entry.toLocalURL(); var fileAry=[]; fileAry.push(tmpPath); _self.compressImg(fileAry); }) }, function( error ) {}, {format:fmt}); }
plus 就是H5+ 的接口調用。ui
注意事項
咱們在使用這些接口的時候,須要將系統打包成app,不然plus 不能使用。this