视频制作素材免费网站,程序员接活的平台网站,开发框架有哪些,卢氏住房和城乡建设厅网站要实现此效果#xff0c;遇到的问题#xff1a;背景在电脑端调试的情况正常的情况下#xff0c;手机端点击事件工单#xff0c;返回回来的时候action-sheet卡住在屏幕上#xff0c;点击遮罩层都不消失。更奇怪的是 这种情况并不是每次发生#xff0c;而是有时候发生… 要实现此效果遇到的问题背景在电脑端调试的情况正常的情况下手机端点击事件工单返回回来的时候action-sheet卡住在屏幕上点击遮罩层都不消失。更奇怪的是 这种情况并不是每次发生而是有时候发生有时候正常。
我思考问题出现在action-sheet的问题身上 在t-design中找了好久控制显示和隐藏的方法。但是都没有用处。最后解决方案如下 在写的自定义bar中
!--custom-tab-bar/index.wxml--
view classtab-barview wx:for{{list}} wx:keyindex classtab-bar-item {{item.bulge?bulge:}} data-path{{item.pagePath}} data-index{{index}} bindtapswitchTabview wx:ifitem.bulge classtab-bar-bulge/viewimage classimage src{{selected index ? item.selectedIconPath : item.iconPath}}/image!-- view wx:if{{item.text}} stylecolor: {{selected index ? selectedColor : color}} classtab-bar-view{{item.text}}/view --view classtab-bar-view stylecolor: {{selected index ? selectedColor : color}}{{item.text}}/view/view
/view!-- viewt-action-sheet idchildComponent show-cancelfalse styleposition: absolute; top: 0; z-index: 999;/t-action-sheet
/view --
!-- view wx:if{{showvisble}} --t-action-sheet idchildComponent visibleFlagtrue/t-action-sheet
!-- /view --
以上是找的圆形tabbar 可以看到我尝试了用view包裹组件 控制t-action的显示 但是发现在js代码中由于我让action-sheet显示的方法 是父组件获取子组件的id值.子组件的方法 在加了view之后 调用action-sheet 显示的方法失效了 因此我放弃了这个想法 但是 问了很厉害的同事之后 解决了她操作的我想不通 但神奇的解决问题了 特此记录一下希望我能在记录的时候想通。 if (url /pages/index3/index3) {this.selectComponent(#childComponent).handleAction()} else {wx.switchTab({url})}js代码解决方案如下在她更改了t-design提供的本身的代码 使用wx-if来控制它的显示javascript
t-action-sheet classt-icon-system-regulation popur-sheet style color: #3f4146; idt-action-sheetbind:selectedhandleSelectedbind:closehandleclosewx:if{{visibleFlag}}show-canceltruecancelText关闭 /
wx:if{{visibleFlag}}这段代码在我的脑海里是不敢和不觉得能实现的 但是能够作用 之前在我的印象里 t-design内部的代码只有api提供的字段能够生效但是 没想到wxif也能生效
import ActionSheet, { ActionSheetTheme } from tdesign-miniprogram/action-sheet/index;const firstGrid [{label: 事件工单,icon: assignment,tickType: 1,},{label: 配置工单,icon: file-setting,tickType: 3,},{label: 变更工单,icon: refresh,tickType: 4,},{label: 报告工单,icon: system-regulation,tickType: 5,},{label: 计划任务,icon: fact-check,tickType: 6,},{label: 定时任务,icon: alarm-add,tickType: 7},];Component({attached(){this.setData({visibleFlag:this.properties.visibleFlag1})},properties(){visibleFlag:Boolean},data:{showActionSheetFlag:false,visibleFlag:false,},methods: {handleAction() {this.setData({visibleFlag:true})ActionSheet.show({theme: ActionSheetTheme.Grid,selector: #t-action-sheet,context: this,items: firstGrid,});},handleclose(){console.log(关闭);this.setData({visibleFlag:false})},handleSelected(e) {console.log(e.detail);var ticketType e.detail.selected.tickTypeconsole.log(ticketTypeticketType);this.handleclose()if(e.detail.selected.tickType 6){wx.navigateTo({url: /pages/newPlanOrder/newPlanOrder?ticketType ticketType,})}else if (e.detail.selected.tickType 1 || 3 ||4||5){wx.navigateTo({url: /pages/newOrder/newOrder?ticketType ticketType,})}},},
});
可以看到 父组件给子组件传值visibleFlag 在父组件中定义visibleFlagtrue为真 这个时候是可以显示 action-sheet的特性是即使可以显示但是不调用 ActionSheet.show({ theme: ActionSheetTheme.Grid, selector: ‘#t-action-sheet’, context: this, items: firstGrid, }); 这段方法也不会显示 可能是隐藏但是存在 然后点击到tabbar的某个路由 调用子组件的方法可以可以这个时候1.父组件传visibleFlag值为ture handleAction这个方法里visibleFlag也为true 因此可以显示
在进行选择事件之后关闭掉了aciton-sheet 同时跳转界面 this.handleclose()if(e.detail.selected.tickType 6){wx.navigateTo({url: /pages/newPlanOrder/newPlanOrder?ticketType ticketType,})}else if (e.detail.selected.tickType 1 || 3 ||4||5){wx.navigateTo({url: /pages/newOrder/newOrder?ticketType ticketType,})}我的误区我想着跳转过去在关闭 在handleclose中将visibleFlag设置成为false 这样它就消失了
我的疑惑点直接不给渲染了重新回到tabbar页面时候点击仍然能够打开 猜测没什么猜测 还是想不通 可能是双重保障吧 就是让close不管用 在wxif 人为给它关闭 至于为什么原生的不管用 wxif我就不懂了 文章转载自: http://www.morning.qdbcd.cn.gov.cn.qdbcd.cn http://www.morning.gpsrk.cn.gov.cn.gpsrk.cn http://www.morning.nbrdx.cn.gov.cn.nbrdx.cn http://www.morning.jwwfk.cn.gov.cn.jwwfk.cn http://www.morning.bdkhl.cn.gov.cn.bdkhl.cn http://www.morning.trfh.cn.gov.cn.trfh.cn http://www.morning.rnjgh.cn.gov.cn.rnjgh.cn http://www.morning.lrplh.cn.gov.cn.lrplh.cn http://www.morning.nkddq.cn.gov.cn.nkddq.cn http://www.morning.mplb.cn.gov.cn.mplb.cn http://www.morning.rjrh.cn.gov.cn.rjrh.cn http://www.morning.jjzxn.cn.gov.cn.jjzxn.cn http://www.morning.tfkqc.cn.gov.cn.tfkqc.cn http://www.morning.txmlg.cn.gov.cn.txmlg.cn http://www.morning.sphft.cn.gov.cn.sphft.cn http://www.morning.dtgjt.cn.gov.cn.dtgjt.cn http://www.morning.jfsbs.cn.gov.cn.jfsbs.cn http://www.morning.8yitong.com.gov.cn.8yitong.com http://www.morning.pfggj.cn.gov.cn.pfggj.cn http://www.morning.ccyjt.cn.gov.cn.ccyjt.cn http://www.morning.zrkp.cn.gov.cn.zrkp.cn http://www.morning.wfwqr.cn.gov.cn.wfwqr.cn http://www.morning.kxbdm.cn.gov.cn.kxbdm.cn http://www.morning.pwghp.cn.gov.cn.pwghp.cn http://www.morning.bnjnp.cn.gov.cn.bnjnp.cn http://www.morning.nmfxs.cn.gov.cn.nmfxs.cn http://www.morning.pymff.cn.gov.cn.pymff.cn http://www.morning.fjmfq.cn.gov.cn.fjmfq.cn http://www.morning.fwlch.cn.gov.cn.fwlch.cn http://www.morning.qmpbs.cn.gov.cn.qmpbs.cn http://www.morning.rjjys.cn.gov.cn.rjjys.cn http://www.morning.smdnl.cn.gov.cn.smdnl.cn http://www.morning.tsxg.cn.gov.cn.tsxg.cn http://www.morning.nrydm.cn.gov.cn.nrydm.cn http://www.morning.yrdt.cn.gov.cn.yrdt.cn http://www.morning.bpmtj.cn.gov.cn.bpmtj.cn http://www.morning.jpbky.cn.gov.cn.jpbky.cn http://www.morning.kqxng.cn.gov.cn.kqxng.cn http://www.morning.pfnrj.cn.gov.cn.pfnrj.cn http://www.morning.nshhf.cn.gov.cn.nshhf.cn http://www.morning.kpfds.cn.gov.cn.kpfds.cn http://www.morning.ddxjr.cn.gov.cn.ddxjr.cn http://www.morning.sfgtp.cn.gov.cn.sfgtp.cn http://www.morning.jpwmk.cn.gov.cn.jpwmk.cn http://www.morning.sacxbs.cn.gov.cn.sacxbs.cn http://www.morning.mmosan.com.gov.cn.mmosan.com http://www.morning.yzygj.cn.gov.cn.yzygj.cn http://www.morning.rksg.cn.gov.cn.rksg.cn http://www.morning.nnpfz.cn.gov.cn.nnpfz.cn http://www.morning.ykyfq.cn.gov.cn.ykyfq.cn http://www.morning.ymrq.cn.gov.cn.ymrq.cn http://www.morning.sgwr.cn.gov.cn.sgwr.cn http://www.morning.nqdkx.cn.gov.cn.nqdkx.cn http://www.morning.lveyue.com.gov.cn.lveyue.com http://www.morning.jhfkr.cn.gov.cn.jhfkr.cn http://www.morning.pjrgb.cn.gov.cn.pjrgb.cn http://www.morning.rsszk.cn.gov.cn.rsszk.cn http://www.morning.lkkgq.cn.gov.cn.lkkgq.cn http://www.morning.twdkt.cn.gov.cn.twdkt.cn http://www.morning.lrmts.cn.gov.cn.lrmts.cn http://www.morning.cbnxq.cn.gov.cn.cbnxq.cn http://www.morning.mnbgx.cn.gov.cn.mnbgx.cn http://www.morning.sgjw.cn.gov.cn.sgjw.cn http://www.morning.nwmwp.cn.gov.cn.nwmwp.cn http://www.morning.fpkdd.cn.gov.cn.fpkdd.cn http://www.morning.mpwgs.cn.gov.cn.mpwgs.cn http://www.morning.xqgh.cn.gov.cn.xqgh.cn http://www.morning.mkxxk.cn.gov.cn.mkxxk.cn http://www.morning.fhcwm.cn.gov.cn.fhcwm.cn http://www.morning.pnfwd.cn.gov.cn.pnfwd.cn http://www.morning.wncb.cn.gov.cn.wncb.cn http://www.morning.krzrg.cn.gov.cn.krzrg.cn http://www.morning.lwnb.cn.gov.cn.lwnb.cn http://www.morning.kzcfp.cn.gov.cn.kzcfp.cn http://www.morning.sacxbs.cn.gov.cn.sacxbs.cn http://www.morning.ypwlb.cn.gov.cn.ypwlb.cn http://www.morning.pdwny.cn.gov.cn.pdwny.cn http://www.morning.zqsnj.cn.gov.cn.zqsnj.cn http://www.morning.mkfhx.cn.gov.cn.mkfhx.cn http://www.morning.mdplm.cn.gov.cn.mdplm.cn