zoukankan      html  css  js  c++  java
  • vue开发系列 调用原生API

    概要

    我们在开发手机端程序的时候了,我们经常需要使用到拍照,二维码的功能.数字天堂公司提供了大量的原生API支持。

    http://www.html5plus.org/doc/

    实现

    1.在hbuilder 选择需要使用的模块

    2.在组件代码中调用相应的API接口。

    比如拍照:

    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});
              }

    注意事项

    我们在使用这些接口的时候,需要将系统打包成app,否则plus 不能使用。

  • 相关阅读:
    javaee 第六周作业
    javaee 第五周作业
    javaee 第四周作业
    第三周作业
    第二周作业xml学习情况
    javaWeb 中http请求 get 与 post的区别
    第八周
    第七周
    第六周
    第五周
  • 原文地址:https://www.cnblogs.com/tommymarc/p/12144728.html
Copyright © 2011-2022 走看看