iccard.js 文件
var Iccard = function(){
...
...
return {
number: function (cb) {
send("findcardHex", FID._findCardHex, argumentify(hdev, 0), function(stat, data){
cb(stat, reverse(data));
});
},
}
};
Iccard.TYPE = {_contactLess:1, _contact:2, _keyBoard:3};
Iccard.R_STAT = {SUCCESS: 0};
if(typeof module != "undefined" && typeof module.exports != "undefined"){
module.exports = Iccard;
}
vue 文件中调用
import icCard from "../../../utils/iccard";
...
methods:{
getCardContent () {
icCard.number(function (stat, cardNumber) {
console.log(cardNumber)
});
},
}
...
import icCard from "../../../utils/iccard";
需要改为import {icCard} from "../../../utils/iccard";
同时后面使用的时候应该用Iccard()...