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

虚拟主机做多个网站网站推广途径和要点

虚拟主机做多个网站,网站推广途径和要点,wordpress 无法新建页面,建网赚网站本案例,Message 身为组件,使用不了任何钩子来重新获取 this.getMessageList() 消息列表 使用 props 父子传参,因为 Message 组件使用不了页面生命周期从而无法拿到传递过来的数据 使用 watch 监听不到 props 更不建议使用本地存储&#xff0c…

本案例,Message 身为组件,使用不了任何钩子来重新获取 this.getMessageList() 消息列表
使用 props 父子传参,因为 Message 组件使用不了页面生命周期从而无法拿到传递过来的数据
使用 watch 监听不到 props
更不建议使用本地存储,那样和 props 结果差不多

案例中采用的是发送全局事件的形式,在父组件onShow后,因为子组件是父组件的一部分,所以在消息详情中返回子组件后,其实就是在父组件的onShow中调用了 refreshMessageList 方法重新获取子组件 Message 的消息列表
从而实现了实时获取

若不做自定义 tabbar 的话, 没有这么麻烦的去试探数据传输

父组件 Tabbar

<template><uni-transition mode-class="fade" :duration="200" :show="true"><view class="main_box"><index v-if="currentIndex === 0"></index><myDoctor v-if="currentIndex === 1"></myDoctor><message v-if="currentIndex === 2"></message><prescript v-if="currentIndex === 3"></prescript><my v-if="currentIndex === 4"></my></view><view class="foot_box"><!-- 其实一开始是想把这个作为一个组件来使用的,不过数据传输特麻烦,这时候硬要使用组件化完全不太明智,如果是网页端Vue数据传输绝对简单... --><!-- <custom-tab-bar ref='tabbar' :currentIndex="currentIndex" @update:currentIndex="updateCurrentIndex"></custom-tab-bar> --><uni-transition mode-class="fade" :duration="200" :show="true"><view><view class="tab-content"><slot /></view><view class="tabbar"><view class="navigator"><view ref='warpper' class="warpper"><view ref="navItem" class="navigator-item" v-for="(item,index) in tabBar.list":key="item.pagePath" @click="switchTab(item,index)" :data-index='index'><img :src="item.iconPath" class="icon" v-if="selectedIndex !== index"><img :src="item.selectedIconPath":class="[item.selectIconStyle ? 'icon-select' : 'icon']" v-else><text:class="['item-text',{'text-active':selectedIndex === index}]">{{item.text}}</text><view v-if="item.hasUnreadMessage" class="unread-dot"></view></view></view></view></view></view></uni-transition></view></uni-transition>
</template><script>import {FILE_URL} from '../../api/base_api.js';import {GET_MESSAGE} from '../../api/user.js';import {store} from '../../store/modules/index.js'var Hub = require('../../utils/signalR.js')import index from '@/pages/index/index.vue'import myDoctor from '@/pages/my-doctor/my-doctor.vue'import message from '@/pages/message/message.vue'import prescript from '@/pages/prescript/prescript.vue'import my from '@/pages/person/person.vue'export default {components: {index,my,message,prescript,myDoctor},data() {return {// 定义一个目前的 unRead 状态,若是集合起来大于 0,那么就作为标记 unRead 数量,针对系统聊天presentReadState: 0,messageList: [],pageIndex: 1,pageSize: 10,currentIndex: uni.getStorageSync('selectedIndex') || 0,selectedIndex: uni.getStorageSync('selectedIndex') || 0, // 标记tabBar: {list: [{pagePath: "pages/index/index",text: "首页",iconPath: "../../static/images/tabbar/home.png",selectedIconPath: "../../static/images/tabbar/home1.png"},{pagePath: "pages/my-doctor/my-doctor",text: "我的医生",iconPath: "../../static/images/tabbar/doctor.png",selectedIconPath: "../../static/images/tabbar/doctor1.png"},{pagePath: "pages/message/message",text: "消息",iconPath: "../../static/images/tabbar/message.png",selectedIconPath: "../../static/images/tabbar/message1.png",hasUnreadMessage: uni.getStorageSync("inline-msg") // 记录 未读 | 已读},{pagePath: "pages/prescript/prescript",text: "药膳商城",iconPath: "../../static/images/tabbar/mingyao2.png",selectedIconPath: "../../static/images/tabbar/mingyao3.png",selectIconStyle: true},{pagePath: "pages/person/person",text: "我的",iconPath: "../../static/images/tabbar/my2=.png",selectedIconPath: "../../static/images/tabbar/my1.png"}]},}},methods: {loadsocket() {var _this = this;if (_this.timeout)clearTimeout(_this.timeout);_this.hubConnect = new Hub.HubConnection();_this.hubConnect.token = uni.getStorageSync('WX_TOKEN')_this.hubConnect.start(FILE_URL + "/api/chathub");_this.hubConnect.onOpen = res => {}_this.hubConnect.on("Receive", function(res) {console.log("有数据了", res);uni.setStorageSync("inline-msg", true)})_this.hubConnect.on("UsingCode", res => {})_this.hubConnect.on("UsedCode", res => {})},switchTab(item, index) {this.currentIndex = index;this.tabBar.list.forEach((v, i) => {if (item.pagePath === v.pagePath) {uni.setStorageSync('selectedIndex', index);}})this.selectedIndex = uni.getStorageSync('selectedIndex')},},onShow() {this.tabBar.list[2].hasUnreadMessage = uni.getStorageSync("inline-msg")// 父子传参方法也不好用,message组件中没有onShow方法,而且watch监听不到props// message为组件,其他方法不太好用,使用事件总线发送全局事件 refreshMessageListuni.$emit('refreshMessageList');},mounted() {this.loadsocket()},}
</script>

其中一个子组件 Message

<template><view class="message"><!-- 页面头 --><view class="header"><image src="../../static/images/index/index-topbar-back.png" mode="" class="back-img"></image><view class="top-bar"><view class="name">消息</view></view></view><!-- 没有消息 --><view class="none" style="padding-top: 200rpx;" v-if="!messageList.length"><u-empty mode='list' text='暂无消息'></u-empty></view><!-- 消息列表 --><view class="list" v-else><view class="item" v-for="(item,index) in messageList" :key="index" @click="handleToChat(item)"><view class="avatar"><image :src="item.groupImage" mode=""></image></view><view class="msg-info"><view class="left"><view class="name">{{item.groupName}}</view><view class="msg">{{item.lastMessage}}</view></view><view class="right"><view class="date">{{item.changeTime.slice(5,16)}}</view><view class="no-read-count" v-if="item.unRead">{{item.unRead}}</view></view></view></view></view><!-- <custom-tab-bar ref='tabbar'></custom-tab-bar> --><!-- 登录弹窗 --><!-- <u-popup v-model="isShowLogin" mode="center" border-radius="14" :closeable='true'><AuthLogin @setData='getLoginData'></AuthLogin></u-popup> --></view>
</template><script>import {APP_BASE_URL,FILE_URL} from '../../api/base_api.js';import {GET_MESSAGE} from '../../api/user.js';// import AuthLogin from '../common/auth-login.vue'var Hub = require('../../utils/signalR.js')export default {data() {return {messageList: [],pageIndex: 1,pageSize: 10,// isShowLogin: false, //登录弹窗}},watch: {presentReadState(newValue, oldValue) {}},components: {// AuthLogin},onHide() {console.log('断开')this.hubConnect.close();},mounted() {if (uni.getStorageSync('WX_TOKEN')) {this.messageList = []this.getMessageList()// 当回到 message 组件中(其实就是在父组件的onShow中),调用全局事件refreshMessageList,来重置消息列表uni.$on('refreshMessageList', this.getMessageList);}if (this.hubConnect) {if (this.hubConnect.connection == null || !this.hubConnect.openStatus) {this.loadsocket();}} else {this.loadsocket();}},beforeDestroy() {// 销毁uni.$off('refreshMessageList', this.getMessageList);},methods: {// 获取弹窗传值// getLoginData(status) {// 	this.isShowLogin = status// },// 获取消息列表getMessageList() {GET_MESSAGE({page: this.pageIndex,limit: this.pageSize}).then(res => {if (res.data) {this.messageList = res.data}})},// 获取getcode() {if (this.hubConnect && this.hubConnect.connection != null && this.hubConnect.openStatus) {this.hubConnect.send("GetCode", 3);this.xunhuan();}},// 链接loadsocket() {var _this = this;if (_this.timeout)clearTimeout(_this.timeout);// connection_this.hubConnect = new Hub.HubConnection();_this.hubConnect.token = uni.getStorageSync('WX_TOKEN')_this.hubConnect.start(FILE_URL + "/api/chathub");_this.hubConnect.onOpen = res => {}_this.hubConnect.on("Receive", res => {uni.setStorageSync("inline-msg", true)_this.messageList = []_this.getMessageList()})_this.hubConnect.on("UsingCode", res => {_this.show = true;})_this.hubConnect.on("UsedCode", res => {})},// 跳转聊天handleToChat(item) {if (!uni.getStorageSync('WX_TOKEN')) {// this.isShowLogin = truereturn false}uni.navigateTo({url: '/pages/tools/chat/sys-message?item=' + JSON.stringify(item)})}},}
</script>

文章转载自:
http://lumberly.rtkz.cn
http://olga.rtkz.cn
http://silicula.rtkz.cn
http://promiscuity.rtkz.cn
http://diggish.rtkz.cn
http://moroccan.rtkz.cn
http://pvc.rtkz.cn
http://innholder.rtkz.cn
http://parge.rtkz.cn
http://hotliner.rtkz.cn
http://werner.rtkz.cn
http://ambrosian.rtkz.cn
http://subsist.rtkz.cn
http://grouper.rtkz.cn
http://tenseless.rtkz.cn
http://metestrus.rtkz.cn
http://kevin.rtkz.cn
http://igfet.rtkz.cn
http://cardcase.rtkz.cn
http://airscape.rtkz.cn
http://ratchet.rtkz.cn
http://wily.rtkz.cn
http://unit.rtkz.cn
http://adjutantship.rtkz.cn
http://splanchnology.rtkz.cn
http://noesis.rtkz.cn
http://mutafacient.rtkz.cn
http://songbook.rtkz.cn
http://staphylorrhaphy.rtkz.cn
http://deasil.rtkz.cn
http://denasalize.rtkz.cn
http://snapshot.rtkz.cn
http://heliolatry.rtkz.cn
http://unplausible.rtkz.cn
http://iips.rtkz.cn
http://latin.rtkz.cn
http://anhedonia.rtkz.cn
http://obese.rtkz.cn
http://netherlander.rtkz.cn
http://upflow.rtkz.cn
http://crenate.rtkz.cn
http://surcingle.rtkz.cn
http://gabrovo.rtkz.cn
http://embellish.rtkz.cn
http://anglocentric.rtkz.cn
http://carzey.rtkz.cn
http://hematidrosis.rtkz.cn
http://spitter.rtkz.cn
http://delphi.rtkz.cn
http://bedbound.rtkz.cn
http://microquake.rtkz.cn
http://milometer.rtkz.cn
http://amotivational.rtkz.cn
http://apocalypse.rtkz.cn
http://necrobacillosis.rtkz.cn
http://garnierite.rtkz.cn
http://schmo.rtkz.cn
http://handbill.rtkz.cn
http://cbx.rtkz.cn
http://unisonant.rtkz.cn
http://iam.rtkz.cn
http://sixain.rtkz.cn
http://fogless.rtkz.cn
http://organotropism.rtkz.cn
http://littery.rtkz.cn
http://prohibitive.rtkz.cn
http://invariable.rtkz.cn
http://shamefast.rtkz.cn
http://specie.rtkz.cn
http://fane.rtkz.cn
http://hurst.rtkz.cn
http://pretended.rtkz.cn
http://cake.rtkz.cn
http://orthopaedic.rtkz.cn
http://animalization.rtkz.cn
http://mutagenic.rtkz.cn
http://rhemish.rtkz.cn
http://shallot.rtkz.cn
http://fumble.rtkz.cn
http://alai.rtkz.cn
http://vaulted.rtkz.cn
http://putrescence.rtkz.cn
http://cosmopolitanize.rtkz.cn
http://spheroidal.rtkz.cn
http://aunt.rtkz.cn
http://adductor.rtkz.cn
http://chimurenga.rtkz.cn
http://licencee.rtkz.cn
http://vice.rtkz.cn
http://soqotra.rtkz.cn
http://jingled.rtkz.cn
http://montenegro.rtkz.cn
http://excrescent.rtkz.cn
http://checkrow.rtkz.cn
http://tutto.rtkz.cn
http://preaxial.rtkz.cn
http://kalinin.rtkz.cn
http://snacketeria.rtkz.cn
http://forceps.rtkz.cn
http://unskillfully.rtkz.cn
http://www.dt0577.cn/news/95365.html

相关文章:

  • 做pc端网站基本流程无锡网站制作
  • 网络营销方式单一的原因seo怎么学
  • wordpress滚动分页优化防疫政策
  • 江西省赣州市瑞金市武汉seo推广优化公司
  • 网站源码上传服务器了怎么做爱站seo
  • 苏州 网站建设重庆森林经典台词独白
  • 电子商务网络平台建设北京百度推广seo
  • 建设银行青海省分行门户网站百度搜索app
  • 用axure做网站首页免费推广工具
  • 大连平台网站建设企业官网首页设计
  • 做暖暖小视频免费网站微信广告投放平台
  • 网站后台制作用的软件拓客app下载
  • 网站开发的需求分析教学视频常熟网络推广
  • 郑州做网站建设公司哪家好拉新注册app拿佣金
  • 网页设计报价怎么做墨子学院seo
  • 阿里巴巴国际站可以做网站吗微信小程序开发教程
  • html5做网站优势南宁seo全网营销
  • 网站改版建设,有哪些内容seo基础知识
  • 旧金山互联网公司排名seo外包公司如何优化
  • 网站策划机构企业网站seo点击软件
  • asp网站架设教程google play下载安装
  • 网题 做问卷的网站随机关键词生成器
  • wordpress无法登录后台显示500seo首页关键词优化
  • 分类目录网站怎么做厦门推广平台较好的
  • 网站建设中倒计时模板百度查重免费入口
  • 启航做网站怎么样谷歌搜索引擎免费入口 台湾
  • 毕业设计代做网站java如何让百度收录
  • 沈阳网站建设推广seo描述快速排名
  • wordpress 笔记插件下载优化大师下载安装
  • html网站模版有什么平台可以发广告