gisq-hb-sumipos-lib
v0.0.3
Published
## Project setup ``` npm install ```
Downloads
3
Maintainers
Readme
default
Project setup
npm install
Compiles and hot-reloads for development
npm run serve
Compiles and minifies for production
npm run build
Run your tests
npm run test
Lints and fixes files
npm run lint
###demo
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<Button @click="printTest()">testPrint</Button>
<Button @click="scanQrTest()">testScanQr</Button>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
import {GisqPosHbLib} from "../gisq/fileLib/posUtil.js"
export default {
name: 'app',
components: {
HelloWorld,
GisqPosHbLib
},
data(){
return {
gisqPosLib:null,
deviceInfo:"",
}
},
methods:{
printTest:function(){
this.gisqPosLib.print('{"fontSize":36,"action":""}',"sss",function(msg){
})
},
scanQrTest:function(){
this.gisqPosLib.scanQr(function(msg){
console.log("scan callback"+JSON.stringify(msg));
})
},
getDeviceInfo:function(){
var _this=this;
this.gisqPosLib.getDeviceInfo(function(info){
_this.deviceInfo=info;
console.log(JSON.stringify(info));
});
}
},
mounted:function(){
var _this=this;
/* if(window.plus){
// 在这里调用5+ API
this.down();
}else{// 兼容老版本的plusready事件
document.addEventListener('plusready',function () {
// 在这里调用5+ API
_this.down()
},false);
} */
this.gisqPosLib=new GisqPosHbLib({});
var _this=this;
setTimeout(function(){
_this.gisqPosLib.ready(function(){
_this.getDeviceInfo();
});
},1000);
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>