vue中使用mqtt没问题,在nvue中就会报错。TypeError: socketTask.onOpen is not a function
connect: function () {  
    console.log('进入页面')  
      var hosts = "",  
        // #ifdef MP-WEIXIN  
        hosts = "wxs://" + this.serve.host + this.serve.path;  
      //#endif  
      // #ifdef APP-PLUS  
      hosts =  
        "wx://" + this.serve.host + ":" + this.serve.port + this.serve.path;  
      //#endif  
      if (this.client == null || this.client.connented == false) {  
        uni.showLoading({  
          title: "连接中···",  
        });  
        this.connectSuccess(false);  
        console.log(hosts, this.options);  
        this.client = mqtt.connect(hosts, this.options);  
        this.client.on("connect", () => {  
          uni.hideLoading();  
          console.log('连接成功')  
          this.showToast("连接成功", 1000, "success");  
          this.connectSuccess(true);  
          this.subscribe();  
        });  
      }  
      this.client.on("reconnect", (error) => {  
        uni.hideLoading();  
        this.showToast("正在重连···", 1000);  
      });  
      this.client.on("error", (error) => {  
        uni.hideLoading();  
        this.showToast("连接失败!", 1000);  
        this.connect();  
      });  
    }, 
             
             
             
			 
                                        
                                     
                                                                     
                                                                    
 
            
唬唬唬
请问H5和微信小程序上可以使用uni.createMapContex,但是H5获取不到原生地图对象 plus.maps.Map,微信小程序报错 $getAppMap is not a function 是什么原因呢?已经配置自定义组件模式了
2020-10-22 09:13
DCloud_UNI_GSQ
回复 唬唬唬: h5没有原生AppMap
2020-10-22 11:02
DCloud_UNI_GSQ
具体的看一下文档
2020-10-22 11:03
唬唬唬
回复 DCloud_UNI_GSQ: 不好意思,因为问了你们好几个人没有回复,官群也是 文档上也不是很详细呀,那微信小程序呢?在微信小程序上报错 $getAppMap is not a function 是什么原因呢?
2020-10-22 14:18
DCloud_UNI_GSQ
回复 唬唬唬: 文档里搜$getAppMap可以得到如下信息:$getAppMap是用于获取plus。map对象,而plus.map是html5plus(App)环境才有的
2020-10-22 14:41
j***@163.com (作者)
Thanks♪(・ω・)ノ
2020-10-22 15:26
唬唬唬
回复 DCloud_UNI_GSQ: 好的 明白了,十分感谢
2020-10-22 15:28
香蕉不是笨啦啦
最新版3.7.9问题还是存在,编译app还是要加这行
2023-04-10 14:01