建设银行网站适用浏览器和政网站建设
news/
2025/9/27 10:04:28/
文章来源:
建设银行网站适用浏览器,和政网站建设,oa系统使用步骤,足球网站模板微信小程序自带tabbar#xff0c;但无法实现中间按钮凸起样式和功能#xff0c;因此按照设计重新自定义一个tabbar
1、创建tabbar文件#xff0c;与pages同级创建一个文件夹#xff0c;custom-tab-bar,里面按照设计图将底部tabbar样式编写
view classtab-bar但无法实现中间按钮凸起样式和功能因此按照设计重新自定义一个tabbar
1、创建tabbar文件与pages同级创建一个文件夹custom-tab-bar,里面按照设计图将底部tabbar样式编写
view classtab-barview classtab-bar-border/viewblock wx:for{{list}} wx:keyindexview wx:if{{item.isSpecial}} classtab-bar-item data-name{{item.text}} data-path{{item.pagePath}} data-click{{ item.isSpecial || false }} data-index{{index}} bindtapswitchTabview classspecial-imageimage classspecial-image-pic modewidthFix src{{selected index ? item.selectedIconPath : item.iconPath}}/image/viewview stylecolor: {{selected index ? selectedColor : color}} classspecial-text tab-text{{item.text}}/view/viewview wx:else classtab-bar-item data-name{{item.text}} data-path{{item.pagePath}} data-click{{ item.isSpecial }} data-index{{index}} bindtapswitchTabimage classitem-image modewidthFix src{{selected index ? item.selectedIconPath : item.iconPath}}/imageview classtab-text stylecolor: {{selected index ? selectedColor : color}}{{item.text}}/viewview classnum wx:if{{item.text 消息 message_num ! 0}}{{message_num}}/view/view/block
/view2、在app.js中添加点击事件 /* 自定义底部按钮切换 */getCurrentTabbar(selected, that) {if (typeof that.getTabBar function that.getTabBar()) {if (wx.getStorageSync(openid)) {msg_unread().then(res {that.getTabBar().setData({selected: selected,message_num: res.data.data})})} else {that.getTabBar().setData({selected: selected})}}},3、在app.json中修改默认tabbar数据结构 tabBar: {custom: true,list: [{pagePath: pages/index/index,text: 首页},{pagePath: pages/contact/index,text: 通讯录},{pagePath: pages/release/index,text: 发布},{pagePath: pages/news/index,text: 消息},{pagePath: pages/personal/index,text: 我的}]
},4、在对应的页面中执行点击事件 app.getCurrentTabbar(index,this);/* index:tabbar对应的index */如需源码请点击下载源码或点击顶部下载按钮
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/919320.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!