dgiot / dgiot-mqtt2eventbus

实现vue前端页面的mqtt转vue的消息微服务,让vue各个组件之间通过消息通讯,而不是通过函数调用交互,从而实现代码解耦,类似移动端app的消息通讯架构:消息服务(mqtt)--》 eventbus--》view

Home Page:https://www.npmjs.com/package/@dgiot/dgiot-mqtt-dashboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dgiot-mqtt-dashboard

ommit-activity package Npm Version Node Version
Jsdeliver Month Downloads Install Size Type Support
Outdated Dep Vulnerablities License

微服务架构图_02.png

Installation

yarn add @dgiot/dgiot-mqtt-dashboard

Quick Start

main.js

  import Vue from 'vue'
  import App from './App.vue'

  +import dgiotStore from '@dgiot/dgiot-mqtt-dashboard/src/store'
  +import dgiotBus from '@dgiot/dgiot-mqtt-dashboard/src/utils/bus'
  +import dgiotMixin from '@dgiot/dgiot-mqtt-dashboard/src/mixins/mqtt'

  Vue.use(dgiotBus)
  Vue.mixin(dgiotMixin)
  Vue.config.productionTip = false
  new Vue({
    dgiotStore,
    render: h => h(App),
  }).$mount('#app')

examples.vue

<template>
  <div id="app">
    +<dgiot-mqtt-dashboard />
  </div>
</template>

<script>
+import dgiotMqttDashboard from '@dgiot/dgiot-mqtt-dashboard/mqtt'
export default {
  name: 'App',
  components: {
    +dgiotMqttDashboard
  },
  mounted() {
    console.log(this.Store)
  },
}
</script>

Online examples

Edit gmullerb-react-reducer-provider

About

实现vue前端页面的mqtt转vue的消息微服务,让vue各个组件之间通过消息通讯,而不是通过函数调用交互,从而实现代码解耦,类似移动端app的消息通讯架构:消息服务(mqtt)--》 eventbus--》view

https://www.npmjs.com/package/@dgiot/dgiot-mqtt-dashboard

License:Mozilla Public License 2.0


Languages

Language:JavaScript 85.0%Language:Vue 14.8%Language:HTML 0.2%