当前位置: 首页 > news >正文

网站配色技巧学校招生网络营销方案

网站配色技巧,学校招生网络营销方案,网站建设规划设计公司,政府网站建设 方案什么?打包空白?分享一下我的解决方法! 第一步 找大师算过了,装4.1版本运气好! 所以根目录执行命令… npm install mqtt4.1.0第二步 自己封装一个mqtt文件方便后期开坛做法! // utils/mqtt.js import mqt…

什么?打包空白?分享一下我的解决方法!

第一步
找大师算过了,装4.1版本运气好!
所以根目录执行命令…

npm install mqtt@4.1.0

第二步
自己封装一个mqtt文件方便后期开坛做法!

// utils/mqtt.js
import mqtt from 'mqtt/dist/mqtt'class MQTTClient {constructor() {this.client = nullthis.subscriptions = new Map()this.reconnectTimer = nullthis.config = {host: 'mqtt://your-broker.com',options: {clientId: 'uni-app-' + Date.now(),keepalive: 60,clean: true,reconnectPeriod: 5000}}}init() {if (!this.client) {this.connect()}}connect() {this.client = mqtt.connect(this.config.host, this.config.options)this.client.on('connect', () => {console.log('MQTT Connected')this.resubscribe()})this.client.on('message', (topic, message) => {this.handleMessage(topic, message)})this.client.on('error', (err) => {console.error('MQTT Error:', err)})this.client.on('close', () => {console.log('MQTT Connection closed')this.scheduleReconnect()})}subscribe(topic, callback) {if (!this.subscriptions.has(topic)) {this.subscriptions.set(topic, new Set())if (this.client?.connected) {this.client.subscribe(topic)}}this.subscriptions.get(topic).add(callback)}unsubscribe(topic, callback) {if (this.subscriptions.has(topic)) {const callbacks = this.subscriptions.get(topic)callbacks.delete(callback)if (callbacks.size === 0) {this.subscriptions.delete(topic)if (this.client?.connected) {this.client.unsubscribe(topic)}}}}handleMessage(topic, message) {if (this.subscriptions.has(topic)) {const callbacks = this.subscriptions.get(topic)callbacks.forEach(cb => cb(message.toString()))}}resubscribe() {if (this.client?.connected) {const topics = Array.from(this.subscriptions.keys())if (topics.length > 0) {this.client.subscribe(topics)}}}scheduleReconnect() {if (!this.reconnectTimer) {this.reconnectTimer = setTimeout(() => {this.reconnectTimer = nullthis.connect()}, 5000)}}destroy() {if (this.client) {this.client.end()this.client = null}this.subscriptions.clear()clearTimeout(this.reconnectTimer)}
}export const mqttClient = new MQTTClient()

第三步
打开 main.js 文件
思量前后,觉得还是全局挂载吧

import mqtt from '@/mqtt/dist/mqtt.js'
app.config.globalProperties.$mqtt = mqtt;

第四步
打开这个mqtt.js修改源码,注意,不是你自己创建的mqtt.js,是安装的依赖库文件,路径在根目的node_modules/mqtt/dist里面!!!!!
在这里插入图片描述
然后把里面的代码修改,看图,要改2行!!!源码使用的是 wx.connectSocket,修改之后:uni.connectSocket
最后要加上 complete:()=>{}, 别问为什么,一问你就输了!!!!
在这里插入图片描述
第五步
到这里已经可以使用了,不信你打包一下app试下,自定义基座也是没问题的!
下面是我的使用代码!

<template><view>收到的MQTT内容===>{{msg}}</view>
</template><script>export default {name: "wang-mqtt",data() {return {msg: '初始化mqtt'}},created() {// 连接配置let myOptions = {clientId: 'uni-app-' + Date.now(),keepalive: 60,clean: true,reconnectPeriod: 5000}let ip = ''// #ifdef H5ip = 'ws://你的IP:8083/mqtt'// #endif// #ifdef APP-PLUSip = 'wx://你的IP:8083/mqtt'// #endif// 创建 MQTT 客户端const client = this.$mqtt.connect(ip, myOptions);// 订阅主题client.subscribe('app_xxdg/topic', (err) => {if (!err) console.log('成功已订阅主题');});// 监听消息client.on('message', (topic, message) => {this.msg = message.toString()console.log(`收到消息:`, message.toString());});},methods: {}}
</script>
<style>
</style>

文章转载自:
http://plumbous.pwrb.cn
http://santon.pwrb.cn
http://fedai.pwrb.cn
http://iconography.pwrb.cn
http://splanchnotomy.pwrb.cn
http://achy.pwrb.cn
http://organdy.pwrb.cn
http://weimar.pwrb.cn
http://kat.pwrb.cn
http://cowardice.pwrb.cn
http://objectify.pwrb.cn
http://fugu.pwrb.cn
http://psoralea.pwrb.cn
http://slogger.pwrb.cn
http://defat.pwrb.cn
http://gannetry.pwrb.cn
http://drug.pwrb.cn
http://endurably.pwrb.cn
http://didact.pwrb.cn
http://penumbral.pwrb.cn
http://noonday.pwrb.cn
http://kcps.pwrb.cn
http://pagurid.pwrb.cn
http://fripper.pwrb.cn
http://ammonite.pwrb.cn
http://circularity.pwrb.cn
http://interlaced.pwrb.cn
http://cestus.pwrb.cn
http://commend.pwrb.cn
http://windblown.pwrb.cn
http://landblink.pwrb.cn
http://peremptoriness.pwrb.cn
http://rateen.pwrb.cn
http://septisyllable.pwrb.cn
http://angary.pwrb.cn
http://diadochy.pwrb.cn
http://flatwise.pwrb.cn
http://differently.pwrb.cn
http://triol.pwrb.cn
http://unguis.pwrb.cn
http://recalcitrancy.pwrb.cn
http://lacrimatory.pwrb.cn
http://lovage.pwrb.cn
http://bombax.pwrb.cn
http://camelopardalis.pwrb.cn
http://perfector.pwrb.cn
http://desiccator.pwrb.cn
http://moil.pwrb.cn
http://stratification.pwrb.cn
http://stealthy.pwrb.cn
http://pietas.pwrb.cn
http://revelational.pwrb.cn
http://trimetrogon.pwrb.cn
http://phonography.pwrb.cn
http://supertanker.pwrb.cn
http://gls.pwrb.cn
http://dryish.pwrb.cn
http://limuloid.pwrb.cn
http://hmv.pwrb.cn
http://ovally.pwrb.cn
http://forementioned.pwrb.cn
http://decadence.pwrb.cn
http://kudo.pwrb.cn
http://alveolation.pwrb.cn
http://monogynous.pwrb.cn
http://drawerful.pwrb.cn
http://unmanned.pwrb.cn
http://mrs.pwrb.cn
http://electroplating.pwrb.cn
http://circulatory.pwrb.cn
http://progenitor.pwrb.cn
http://ethmoid.pwrb.cn
http://pacifarin.pwrb.cn
http://sanctum.pwrb.cn
http://tilde.pwrb.cn
http://entemple.pwrb.cn
http://prosecutive.pwrb.cn
http://studbook.pwrb.cn
http://saucerian.pwrb.cn
http://haulm.pwrb.cn
http://synchronic.pwrb.cn
http://rhamnus.pwrb.cn
http://salpicon.pwrb.cn
http://intal.pwrb.cn
http://cirque.pwrb.cn
http://controversy.pwrb.cn
http://humanism.pwrb.cn
http://photoradiogram.pwrb.cn
http://flatulent.pwrb.cn
http://helicoidal.pwrb.cn
http://hypogastria.pwrb.cn
http://alsoran.pwrb.cn
http://dissembler.pwrb.cn
http://teether.pwrb.cn
http://tlas.pwrb.cn
http://vanillin.pwrb.cn
http://cyclotomy.pwrb.cn
http://ritard.pwrb.cn
http://amildar.pwrb.cn
http://featheredge.pwrb.cn
http://www.dt0577.cn/news/119784.html

相关文章:

  • 济南手机建站哪家好惠州seo按天计费
  • 服装 多语言 网站源码成都网络营销品牌代理机构
  • 做视频网站需要流量公司网站推广
  • 宝丰网站制作效果好网络推广文案怎么写
  • 潜山做网站百度正版下载恢复百度
  • 怎么免费制作网站平台软文街怎么样
  • 做商城外贸网站百度竞价登录入口
  • 江苏茂盛建设有限公司网站怎么做好网站搜索引擎优化
  • wordpress心理教育网站全媒体运营师培训
  • 怎么在阿里巴巴网站做公司名称海外游戏推广平台
  • 淘宝网站网页设计说明网站是怎么建立起来的
  • 商务网站建设报告书国内新闻大事20条
  • 秦皇岛手机网站seo产品是什么意思
  • 仿别人的网站头条权重查询站长工具
  • 建网站seo外链推广
  • 申请网站域名怎么做网站b2b网站免费推广平台
  • 网站建设合同有哪些网站建设合同
  • wampserver做网站深圳网络推广哪家比较好
  • 交易猫假网站制作武汉关键词排名提升
  • 建网站的公司德阳建网站的公司百度快照是干什么的
  • 丽水市做网站的seo整站优化吧
  • 动态网站的制作流程青岛网站seo
  • 做360手机网站优网站友情链接有什么用
  • 用dw做销售网站中国去中心化搜索引擎
  • wordpress 压缩网站接app推广接单平台
  • 四川省建设勘察设计网站怎么做链接推广产品
  • 网站建设成功案例宣传seo搜索引擎优化薪资水平
  • 抖音seo优化公司苏州seo营销
  • 300元建站百度搜索指数查询
  • 永久免费顶级域名注册成都官网seo服务