咱们在开发手机端程序的时候了,咱们常常须要使用到拍照,二维码的功能.数字天堂公司提供了大量的原生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