1.0.0 • Published 2 years ago
youotech-bluetooth v1.0.0
基于i国网蓝牙 + Vue 框架,封装的组件
安装
npm i youotech-bluetooth -S
## 使用案列
```js全局引用
import Vue from "vue";
import bluetooth from "youotech-bluetooth";
import "youotech-bluetooth/lib/style.css";
Vue.use(bluetooth);局部引用
import { BlueConnect } from "youotech-bluetooth";
import "youotech-bluetooth/lib/style.css";
export default {
components: {
BlueConnect,
},
};template:
<BlueConnect />Constructor Options:
设备对应的编码
激光测距仪: 1,数显卷尺: 2,扭矩扳手: 3,接地电阻: 4,游标卡: 5,
| key | description | default | options |
|---|---|---|---|
| title | 标题 | 分管强度与严密性工艺检测或验证-试验压力 | string |
| code | 编码 | string | |
| v-model | 显示蓝牙组件 | false | boolean |
| WXConfig | 微信配置项 | beta: true, | |
| onNotifyBLECharacteristicValue | 监听蓝牙设备返回值 | {data: string, code: number} | function |
| onBLEConnectionState | 监听蓝牙当前状态 | Object | function |
| onSelect | 选择的返回值 | String | function |
使用案例
返回数据值默认无单位,请自行转换单位
<BlueConnect v-model="visible" @onNotifyBLECharacteristicValue="handleOnNotifyBLECharacteristicValue"
@onBLEConnectionState="onBLEConnectionState"
@onSelect="handleSelect
/>import { BlueConnect } from "youotech-bluetooth";
import "youotech-bluetooth/lib/style.css";
export default {
data() {
return {
visible: false,
};
},
components: {
BlueConnect,
},
methods: {
// 监听数据
handleOnNotifyBLECharacteristicValue(val) {
console.log(val);
},
// 监听列尼加状态
onBLEConnectionState(e) {
console.log(e);
},
handleSelect(val) {
console.log(val);
},
},
};1.0.0
2 years ago
0.0.20
4 years ago
0.0.21
4 years ago
0.0.17
4 years ago
0.0.18
4 years ago
0.0.19
4 years ago
0.0.15
4 years ago
0.0.16
4 years ago
0.0.13
4 years ago
0.0.14
4 years ago
0.0.10
4 years ago
0.0.11
4 years ago
0.0.12
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago