vue 프로젝트 에 H5+사용

1340 단어 vue
설치
npm i vue-awesome-mui


main.js 파일 에 도입
import Mui from 'vue-awesome-mui';
Vue.use(Mui);


H5Plus 가 필요 한 곳 은 먼저:
methods:{
//   API             
  plusReady () {
    var ws = plus.webview.currentWebview(); //pw     plus.webview  
  },
}
created () {
//   API     ,       “plusready"    
  if (window.plus) {
    this.plusReady()
  } else {
    document.addEventListener('plusready', this.plusReady, false) // 
  }
}


예 를 들 어 프로젝트 에서 사진 을 찍 는 방법 을 사용 해 야 한다.

    
    
    
getImage() {
      let cmr = plus.camera.getCamera(); //        
      let res = cmr.supportedImageResolutions[0]; //      ,           
      let fmt = cmr.supportedImageFormats[0]; //      ,            
      console.log("Resolution :" + res + ", Format: " + fmt);
      cmr.captureImage(
        path => {
          alert("    : " + path);
        },
        error => {
          //            
          alert("    : " + error.message);
        },
        { resolution: res, format: fmt } //        
      );
    }

포장 하 다.
npm run build


컴퓨터 운행

좋은 웹페이지 즐겨찾기