main.js 928 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Vue from 'vue'
  2. import App from './App'
  3. //import mqtt from 'mqtt/dist/mqtt.js'
  4. import store from './store'
  5. Vue.prototype.$store = store
  6. Vue.config.productionTip = false
  7. App.mpType = 'app'
  8. // const options = {
  9. // connectTimeout: 4000, // 超时时间
  10. // clientId: "mqtt_" + parseInt(Math.random() * 100 + 800, 10),
  11. // port: 8081,
  12. // };
  13. // const store = {
  14. // debug: true,
  15. // mqttClient:undefined,
  16. // connect(){
  17. // this.mqttClient = mqtt.connect('wxs://test.mosquitto.org', options)
  18. // let that = this;
  19. // //连接成功回调
  20. // that.mqttClient.on("connect", function() {
  21. // that.isConnect = true;
  22. // console.log("connect success!");
  23. // });
  24. // //异常回调
  25. // that.mqttClient.on("error", function(err) {
  26. // that.isConnect = false;
  27. // console.log(err);
  28. // });
  29. // }
  30. // }
  31. const app = new Vue({
  32. store:store,
  33. ...App
  34. })
  35. app.$mount()