1.0.0 • Published 1 year ago

youotech-bluetooth v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

基于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,
keydescriptiondefaultoptions
title标题分管强度与严密性工艺检测或验证-试验压力string
code编码string
v-model显示蓝牙组件falseboolean
WXConfig微信配置项beta: true,
onNotifyBLECharacteristicValue监听蓝牙设备返回值{data: string, code: number}function
onBLEConnectionState监听蓝牙当前状态Objectfunction
onSelect选择的返回值Stringfunction

使用案例

返回数据值默认无单位,请自行转换单位

  <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

1 year 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