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

深圳网站建设团队青岛网站seo诊断

深圳网站建设团队,青岛网站seo诊断,网站整体风格,wordpress搜索按分类前言 使用小程序默认的tabbar可以满足常规开发,但是满足不了个性化需求,如果想个性化开发就需要用到自定义tabbar,以下图为例子 一、在app.json配置 先按照以往默认的形式配置,如果中间的样式特殊则不需要配置 "tabBar": {&qu…

前言

使用小程序默认的tabbar可以满足常规开发,但是满足不了个性化需求,如果想个性化开发就需要用到自定义tabbar,以下图为例子
在这里插入图片描述

一、在app.json配置

先按照以往默认的形式配置,如果中间的样式特殊则不需要配置

"tabBar": {"custom":true,  // 开启自定义tabbar"color": "#333333",  // tabbar文字默认颜色"selectedColor": "#2E41FF", // tabbar文字选中颜色"list": [{"pagePath": "pages/index/index","iconPath": "images/customTabBar/home.png","selectedIconPath": "images/customTabBar/homeSelect.png","text": "首页"},{"pagePath": "pages/user/user","iconPath": "images/customTabBar/my.png","selectedIconPath": "images/customTabBar/mySelect.png","text": "我的"}]
},

二、在app.js中配置

tabBar: {"color": "#333333","selectedColor": "#2E41FF","list": [{"pagePath": "/pages/index/index","iconPath": "/images/customTabBar/home.png","selectedIconPath": "/images/customTabBar/homeSelect.png","text": "首页","selected":true  //该tabbar是否选中的标识},{"pagePath": '',"iconPath": '/images/customTabBar/camera.png',"selectedIconPath": '/images/customTabBar/camera.png',"isSpecial": true,  //是否为特殊的那个tab"selected":false},{"pagePath": "/pages/user/user","iconPath": "/images/customTabBar/my.png","selectedIconPath": "/images/customTabBar/mySelect.png","text": "我的","selected":false}]
}

三、app.js注册tabbar点击方法

主要作用为控制跳转的路径当前tab及选中的样式

editTabbar() {let tabbar = this.globalData.tabBar;let currentPages = getCurrentPages();let _this = currentPages[currentPages.length - 1];let pagePath = _this.route;(pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);for (let i in tabbar.list) {tabbar.list[i].selected = false;(tabbar.list[i].pagePath == pagePath) && (tabbar.list[i].selected = true);}_this.setData({tabbar: tabbar});
},

四、封装自定义tabbar组件

1.html

<view class="ub-tab-bar"><block wx:for="{{tabbar.list}}" wx:key="index"><!-- 中间特殊tab --><view wx:if="{{item.isSpecial}}" class="ub-tab-bar-item" bindtap="camera"><image mode="widthFix" src="{{item.iconPath}}" class="{{item.pagePath === '' ? 'ub-camera' : ''}}"></image><view>{{item.text}}</view></view><!-- 两侧tab -->  <navigator wx:else class="ub-tab-bar-item" hover-class="none" url="{{item.pagePath}}" style="color:{{item.selected ? tabbar.selectedColor : tabbar.color}}" open-type="switchTab"><image mode="widthFix"  src="{{item.selected ? item.selectedIconPath : item.iconPath}}"></image><view>{{item.text}}</view></navigator></block>
</view>

2.json

接收父组件传过来的值

properties: {tabbar: {type: Object}
},

五、在用到的页面引用tabbar组件

在需要用到tabbar的页面引用

1.json中引用

 "usingComponents": {"tabBar": "/components/customTabBar/customTabBar",}

2.js

data中获取在app.js定义的tabBar

data: {tabBar:app.globalData.tabBar
}
//隐藏移动的tabbar并调用app.js定义的方法
onLoad(){wx.hideTabBar()app.editTabbar();
}

3.html中引用

获取到的方法想子组件中传递

<tabBar tabbar="{{tabBar}}"></tabBar>
http://www.dtcms.com/wzjs/224625.html

相关文章:

  • 网站建设的税收编码厦门网站的关键词自动排名
  • 哪个素材网站比较好用网站设计费用明细
  • 盐田区网站建设网站建设方案书
  • 电子商务网站开发项目策划书搜索引擎优化的概念
  • 做视频解析网站是犯法的么微信营销平台系统
  • 有关网站建设新闻资讯南京seo排名扣费
  • 深圳高端品牌网站建设推广产品的软文怎么写
  • 中国企业500强最新排名一键优化清理
  • 厦门市建设合同备案网站百度知道客服
  • 网站建设优化石家庄媒体代发布
  • 重庆企业网站开发方案seo的主要工作内容
  • 如何做旅游攻略网站营销策划公司名称
  • 上海搜索排名优化公司北京seo费用是多少
  • 青岛做物流网站宜昌网站seo
  • wordpress 站外搜索网络营销软件
  • 祥云平台英文网站百度的广告推广需要多少费用
  • 做网站建设的网站济南优化网络营销
  • 聊城高端网站设计建设域名注册需要多少钱
  • 网站建设柳市注册城乡规划师报考条件
  • 网站建设在windos的设置搜索引擎营销的特点包括
  • 怎么样免费做网站百度广告电话号码是多少
  • 国家林业工程建设协会网站网店无货源怎么做
  • 怎么样可以做网站百度竞价登陆
  • 商业网站开发文档优化大师官网
  • 做维修广告效最好是哪个网站吗seo综合查询 站长工具
  • 做网站联系方式武汉大学人民医院怎么样
  • 网站首页设计多少钱篮网最新消息
  • 上海论坛网站建设网页链接制作生成
  • 秋林 做网站seo搜索引擎优化报价
  • 广州公安局门户网站云盘搜