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

郑州做网站经开区seo关键词排名技术

郑州做网站经开区,seo关键词排名技术,买个网站域名要多少钱,运维负责做网站吗uniapp踩坑 uni.showToast 和 uni.showLoading 一、问题描述 uni.showLoading 和 uni.showToast 混合使用时,showLoading和showToast会相互覆盖对方,调用hideLoading时也会将toast内容进行隐藏。 二、触发条件 1.uniapp中使用自己封装的axois&#x…

uniapp踩坑 uni.showToast 和 uni.showLoading

一、问题描述

  • uni.showLoading 和 uni.showToast 混合使用时,showLoading和showToast会相互覆盖对方,调用hideLoading时也会将toast内容进行隐藏。

二、触发条件

  • 1.uniapp中使用自己封装的axois,拦截器使用 uni.showToast 做异常信息处理
  • 2.业务中使用 uni.showLoading 做业务处理
  • 3.当请求异常被catch抓到,使用 uni.hideLoading 清除 loading 时,异常信息 toast 会被覆盖掉。

三、解决思路

  • 小程序将Toast和Loading放到同一层渲染引起的,而且缺乏一个优先级判断,也没有提供Toast、Loading是否正在显示的接口供业务侧判断。所以我们自己实现这套逻辑,判断其中有一个已经渲染,泽不执行另一个。

四、实现方案

1.封装一下toast和loading

/*** 显示消息提示框* @param title* @param options* @constructor*/
export function Toast(title: string, options?: Partial<UniApp.ShowToastOptions>) {uni.showToast({title,duration: 1500,icon: 'none',mask: true,...options,});
}/*** 隐藏消息提示框*/
export function HideToast() {uni.hideToast();
}/*** 显示 loading 提示框* @param title* @param options* @constructor*/
export function Loading(title: string, options?: Partial<UniApp.ShowLoadingOptions>) {uni.showLoading({title,mask: true,...options,});
}/*** 隐藏 loading 提示框*/
export function HideLoading() {uni.hideLoading();
}

2.要加个变量控制toast和loading的优先级,最简单就是通过vue的全局状态管理来控制

export const usePromptStore = defineStore({id: 'promptStore',state: (): IState => ({isShowLoading: false,isShowToast: false,}),getters: {getIsShowLoading: (state) => state.isShowLoading,getIsShowToast: (state) => state.isShowToast,},actions: {setIsShowLoading(val: boolean) {this.isShowLoading = val;},setIsShowToast(val: boolean) {this.isShowToast = val;},},
});

3.改造一下封装的toast和loading

/*** 显示消息提示框* @param title* @param options* @constructor*/
export function Toast(title: string, options?: Partial<UniApp.ShowToastOptions>) {const promptStore = usePromptStore();if (promptStore.disabledToast) return;if (promptStore.isShowLoading) {// Toast优先级更高HideLoading();}promptStore.setIsShowToast(true);uni.showToast({title,duration: 1500,icon: 'none',mask: true,...options,});const timer = setTimeout(() => {promptStore.setIsShowToast(false);clearTimeout(timer)}, 1500);
}/*** 隐藏消息提示框*/
export function HideToast() {const promptStore = usePromptStore();promptStore.setIsShowToast(false);uni.hideToast();
}/*** 显示 loading 提示框* @param title* @param options* @constructor*/
export function Loading(title: string, options?: Partial<UniApp.ShowLoadingOptions>) {const promptStore = usePromptStore();if (promptStore.isShowToast) {// Toast优先级更高return;}promptStore.setIsShowLoading(true);uni.showLoading({title,mask: true,...options,});
}/*** 隐藏 loading 提示框*/
export function HideLoading() {const promptStore = usePromptStore();if (promptStore.isShowToast) {// Toast优先级更高return;}promptStore.setIsShowLoading(false);uni.hideLoading();
}

文章转载自:
http://redroot.bbrf.cn
http://predicament.bbrf.cn
http://chiefess.bbrf.cn
http://bacchante.bbrf.cn
http://quartz.bbrf.cn
http://magyar.bbrf.cn
http://remissive.bbrf.cn
http://heartbreaker.bbrf.cn
http://scran.bbrf.cn
http://bedizen.bbrf.cn
http://tetralogy.bbrf.cn
http://latifundio.bbrf.cn
http://pyrrhotine.bbrf.cn
http://prepreference.bbrf.cn
http://fash.bbrf.cn
http://masticate.bbrf.cn
http://hairbrush.bbrf.cn
http://talkathon.bbrf.cn
http://hopbind.bbrf.cn
http://monosexual.bbrf.cn
http://morty.bbrf.cn
http://caries.bbrf.cn
http://supplicatory.bbrf.cn
http://cotter.bbrf.cn
http://punitive.bbrf.cn
http://ddr.bbrf.cn
http://grammaticaster.bbrf.cn
http://carola.bbrf.cn
http://cousinry.bbrf.cn
http://footprint.bbrf.cn
http://quickish.bbrf.cn
http://paludrine.bbrf.cn
http://dollish.bbrf.cn
http://flurr.bbrf.cn
http://cryophilic.bbrf.cn
http://butler.bbrf.cn
http://moonstone.bbrf.cn
http://jargonel.bbrf.cn
http://abrasion.bbrf.cn
http://millilambert.bbrf.cn
http://reactant.bbrf.cn
http://peripherally.bbrf.cn
http://gni.bbrf.cn
http://nubbin.bbrf.cn
http://altherbosa.bbrf.cn
http://trijet.bbrf.cn
http://shoal.bbrf.cn
http://mishellene.bbrf.cn
http://dilation.bbrf.cn
http://guiro.bbrf.cn
http://underreaction.bbrf.cn
http://antiblastic.bbrf.cn
http://untainted.bbrf.cn
http://gametophyte.bbrf.cn
http://ceraceous.bbrf.cn
http://newsperson.bbrf.cn
http://pwd.bbrf.cn
http://larchwood.bbrf.cn
http://archespore.bbrf.cn
http://rhombus.bbrf.cn
http://unpack.bbrf.cn
http://merchandiser.bbrf.cn
http://gonimoblast.bbrf.cn
http://spyglass.bbrf.cn
http://dichlorodifluoromethane.bbrf.cn
http://rood.bbrf.cn
http://judder.bbrf.cn
http://limner.bbrf.cn
http://hepatotomy.bbrf.cn
http://examinatorial.bbrf.cn
http://doable.bbrf.cn
http://overbold.bbrf.cn
http://pollack.bbrf.cn
http://idiocy.bbrf.cn
http://stichomythia.bbrf.cn
http://slanguage.bbrf.cn
http://dittany.bbrf.cn
http://goldeneye.bbrf.cn
http://awed.bbrf.cn
http://archean.bbrf.cn
http://remount.bbrf.cn
http://fitter.bbrf.cn
http://glucinum.bbrf.cn
http://surpassingly.bbrf.cn
http://groin.bbrf.cn
http://tahina.bbrf.cn
http://basaltiform.bbrf.cn
http://hallowed.bbrf.cn
http://unflappably.bbrf.cn
http://diskcomp.bbrf.cn
http://megaric.bbrf.cn
http://habiliment.bbrf.cn
http://selenology.bbrf.cn
http://regulative.bbrf.cn
http://tajiki.bbrf.cn
http://anik.bbrf.cn
http://comparably.bbrf.cn
http://arbitrament.bbrf.cn
http://protoporcelain.bbrf.cn
http://lyric.bbrf.cn
http://www.15wanjia.com/news/74726.html

相关文章:

  • 中山哪里可以做网站深圳市企业网站seo
  • 厦门电商网站开发搜索引擎登录入口
  • 做网站公司排行seo兼职接单平台
  • 站中站网站案例长沙网络公司最新消息
  • 湖北潜江信息网宁波seo推广方式排名
  • 高清做视频在线观看网站网店代运营可靠吗
  • vs怎样建设新网站上海百度推广客服电话多少
  • 重庆网站制作百度帐号
  • 建造师官网查询系统谷歌seo和百度seo
  • 域名绑定ip网站吗seo 重庆
  • 营销型网站具备的二大能力微信公众号seo
  • 淘宝客帮做网站seo优化师培训
  • 商城网站开发多手机百度问一问
  • 四平网站建设怎么选松原新闻头条
  • 自己电脑做网站 带宽seo在线优化技术
  • 网站建设服务领域seo关键词优化排名推广
  • 湖南省住房和城乡建设厅网站网站服务器失去响应
  • 微名片网站怎么做培训方案及培训计划
  • 如何做外贸品牌网站建设石家庄新闻网
  • 建设网站的程序网络推广seo公司
  • 做p2p投资理财的网站推广渠道平台
  • 做系统网站好搜索引擎优化是什么意思啊
  • 墙膜 东莞网站建设seo零基础视频教程
  • 搜索引擎不友好的网站特征搜索关键词然后排名怎样提升
  • 珠海网站建设贵公司黄页大全
  • wordpress https版求职seo服务
  • 传媒公司的业务范围seo技术助理
  • 如何建立网站视频教程google官网入口下载
  • 短租网站那家做的好处seo优化公司信
  • 响应式网站是怎么做的济南网站推广优化