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

营销型网站制作费用网络空间安全专业

营销型网站制作费用,网络空间安全专业,网站建设服务公司选哪家比较好?,资阳抖音搜索优化自定义tabBar注意事项#xff1a; 在自定义 tabBar 模式下 #xff0c;为了保证低版本兼容以及区分哪些页面是 tab 页#xff0c;app.json文件中 tabBar 的相关配置项需完整声明#xff0c;但这些字段不会作用于自定义 tabBar 的渲染。所有 tabBar 的样式都由该自定义组件…自定义tabBar注意事项 在自定义 tabBar 模式下 为了保证低版本兼容以及区分哪些页面是 tab 页app.json文件中 tabBar 的相关配置项需完整声明但这些字段不会作用于自定义 tabBar 的渲染。所有 tabBar 的样式都由该自定义组件渲染。推荐用 fixed 在底部的 cover-view  cover-image 组件渲染样式以保证 tabBar 层级相对较高。不使用也没关系与 tabBar 样式相关的接口如 wx.setTabBarItem 等将失效。每个 tab 页下的自定义 tabBar 组件实例是不同的可通过自定义组件下的 getTabBar 接口获取当前页面的自定义 tabBar 组件实例。例如如需实现 tab 选中态要在当前页面下通过 getTabBar 接口获取组件实例并调用 setData 更新选中态。 实现步骤 1. 配置信息 在 app.json 中的 tabBar 项指定 custom 字段值为 true同时其余 tabBar 相关配置也补充完整。所有 tab 页的 json 里需声明 usingComponents 项也可以在 app.json 全局开启。代码示例 app.json中的配置项 tabBar: {custom: true,color: #000000,selectedColor: #CBB486,borderStyle: white,list: [{pagePath: pages/member-announce/index,text: 公告,iconPath: /public/img/icon-announce.png,selectedIconPath: /public/img/icon-announce-selected.png},{pagePath: pages/member-operation/index,text: 活动,iconPath: /public/img/icon-operation.png,selectedIconPath: /public/img/icon-operation-selected.png},{pagePath: pages/space-map/index,text: 空间,iconPath: /public/img/icon-spaceNew.png,selectedIconPath: /public/img/icon-space-selectedNew.png},{pagePath: pages/member-center/index,text: 我的,iconPath: /public/img/icon-centerNew.png,selectedIconPath: /public/img/icon-center-selectedNew.png}]}, 其中 iconPath 代表未被选中时的 icon 图标selectedIconPath 代表当前被选中时的  icon图标。 2. 添加 tabBar 代码文件 在代码根目录下添加入口文件  文件名必须为 custom-tab-bar必须在根目录处添加与page文件同级 custom-tab-bar/index.js custom-tab-bar/index.json custom-tab-bar/index.wxml custom-tab-bar/index.wxss 3. 编写tabBar代码 用自定义组件的方式编写即可该自定义组件完全接管 tabBar 的渲染。另外自定义组件新增 getTabBar 接口可获取当前页面下的自定义 tabBar 组件实例。 4. 实现tabBar选中态 在 tabBar 所在页面的 js或ts 文件中的onShow方法写入 onShow() {if (typeof this.getTabBar function this.getTabBar()) {this.getTabBar().setData({selected: 0 // 当前页面所在数据的索引值})}}, 大家可根据上述步骤一步步实现下面是我的代码demo。先配置好上述步骤中标红的1、2再赋值下面代码最后再在每个tabBar所在的页面配置好选中态再根据项目需求调整即可。 自定义 tabBar 代码示例分享 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:if{{item.bulge}} classtab-bar-bulge tab-bar-view/viewimage classimage src{{selected index ? item.selectedIconPath : item.iconPath}}/imageview wx:if{{item.text}} stylecolor: {{selected index ? selectedColor : color}} classtab-bar-view{{item.text}}/view/view /view custom-tab-bar文件中的index.ts我这里用的是ts用js的伙伴稍微改一下类型就可以 Component({data: {color: #545454,selectedColor: #CBB486,backgroundColor: #fff,list:[{pagePath: /pages/member-announce/index,text: 公告,iconPath: /public/img/icon-announce.png,selectedIconPath: /public/img/icon-announce-selected.png},{pagePath: /pages/member-operation/index,text: 活动,iconPath: /public/img/icon-operation.png,selectedIconPath: /public/img/icon-operation-selected.png},{pagePath: ,bulge: true,iconPath: /public/img/icon-chat-ai.png,selectedIconPath: /public/img/icon-chat-ai.png},{pagePath: /pages/space-map/index,text: 空间,iconPath: /public/img/icon-spaceNew.png,selectedIconPath: /public/img/icon-space-selectedNew.png},{pagePath: /pages/member-center/index,text: 我的,iconPath: /public/img/icon-centerNew.png,selectedIconPath: /public/img/icon-center-selectedNew.png},],},methods: {switchTab(e: { currentTarget: { dataset: any } }) {const data e.currentTarget.datasetconst url data.pathif (url ) {const token wx.getStorageSync(token);wx.navigateTo({ url: token ? /pages/member-chat-ai/index : /pages/login/index });} else {console.log(url);wx.switchTab({ url });}}} }) custom-tab-bar文件中的index.wxss .tab-bar {position: fixed;bottom: 0;left: 0;right: 0;/* 兼容 iOS 11.2 */height: calc(96rpx constant(safe-area-inset-bottom));/* 兼容 iOS 11.2 */height: calc(96rpx env(safe-area-inset-bottom));background: #fff;display: flex;box-shadow: 0px -10rpx 12rpx rgba(0, 0, 0, 0.08); }.tab-bar-item {flex: 1;text-align: center;display: flex;justify-content: center;align-items: center;flex-direction: column; }.tab-bar-item .image {width: 48rpx;height: 48rpx; }.bulge {background-color: #fff; }.bulge .image {position: absolute;width: 96rpx;height: 96rpx;top: 13rpx; }.tab-bar-item .tab-bar-view {font-size: 20rpx; } custom-tab-bar文件中的index.json {component: true } 不要忘记设置选中态 底部效果如图
http://www.pierceye.com/news/273459/

相关文章:

  • 金坛常州做网站成都分销商城网站建设
  • 网站商城系统建设厦门建站方案
  • 新郑郑州网站建设温州网站定制公司哪家好
  • 系统网站建设公司wordpress 命令行高亮
  • 怎样做招聘网站怎么在拼多多卖东西
  • 网站建设与网站管理网站怎么显示百度名片
  • 技术支持 盈岚网站建设典当行网站策划
  • 如何找到网站的模板页面中国优秀网站设计
  • 金融公司 网站开发简易个人博客网站源码
  • 小企业网站建设哪找网站制作软件dw
  • 百度收录提交网站后多久收录重庆个人房源网
  • 深圳网站建设制作公司排名网站设计怎么收费
  • 免费培训学校网站源码成免费crm破解版
  • w网站建设湖北建设厅举报网站
  • 营销型网站分为哪几种乐山网站建设公司
  • 淘宝网站建设类别好看的网站后台界面
  • 海口网站建设工作中企动力全球邮企业邮箱
  • 青岛网站制作排名绵阳做网站优化
  • 扬州市建设工程造价管理站网站开发建设网站
  • 广州网站设计公司济南兴田德润o评价潍坊响应式网站建设要多久
  • 网站模板如何优化平阳县建设局网站
  • 厦门外贸网站找谁可以做app的网站
  • 本地电脑静态网站建设游戏代理平台免费
  • 网站建设公司的成本有哪些内容wordpress admin空白
  • 高端网站建设如何收费济南行业网站建设
  • 昆明网站制作专业麦当劳订餐网站 是谁做的
  • 网站代备案公司名称网页游戏怎么搭建
  • 教师在哪些网站可以做兼职做平面的公司网站
  • php网站后台程序做游戏ppt下载网站有哪些
  • 柳州正规网站制作公司佛山企业名录黄页