【Uniapp 原生插件】商米钱箱插件
商米钱箱插件
-
插件地址:
插件需求
插件介绍
只要是商米设备连接的钱箱, 都能使用此插件打开钱箱,钱箱不限制品牌
使用案例
获取插件
// 商米钱箱插件 let sunmiCashboxPlugin = uni.requireNativePlugin(Tellsea-SunmiCashboxPlugin); console.log(商米钱箱插件: + JSON.stringify(sunmiCashboxPlugin));
连接服务
// 连接服务 connect() { sunmiPrinterPlugin.connect((e) => { let res = JSON.parse(e); console.log(res); if (res.code == 200) { that.$msg(res.msg); } else { that.$msg(res.msg); } }); },
断开服务
// 断开服务 disconnect() { sunmiPrinterPlugin.disconnect((e) => { let res = JSON.parse(e); console.log(res); if (res.code == 200) { that.$msg(res.msg); } else { that.$msg(res.msg); } }); },
打开钱箱
// 打开钱箱 openDrawer() { sunmiCashboxPlugin.openDrawer((e) => { let res = JSON.parse(e); console.log(res); if (res.code == 200) { that.$msg(res.msg); } else { that.$msg(res.msg); } }); },