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

天津制作企业网站报价搜狗输入法下载安装

天津制作企业网站报价,搜狗输入法下载安装,我做动作你来猜的网站,深圳公司注册名称查询前言 使用小程序默认的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.khdw.cn/news/68095.html

相关文章:

  • 深圳网站建设制作订做东莞网站优化公司
  • 做导购类网站正在直播足球比赛
  • 网站开发设计流程时间表晚上国网app
  • 雄安网站建设400多少钱seo实战技术培训
  • web前端工程师前景粤语seo是什么意思
  • 网站设计费最近的重要新闻
  • 南宁好的网站建设公司网络营销的类型有哪些
  • 建设厅安全员证书查询网站品牌营销推广代运营
  • 建设厅八大员seo快排技术教程
  • 怎么判断网站建设年龄十大营销模式
  • 徐城乡建设局网站微商软文范例
  • 广水网站定制网站建设与营销经验
  • 公司网站制作武汉怎么做蛋糕
  • 网站运营编辑seo在线优化工具
  • 如何用php做网站关键词优化教程
  • 导购网站的seo怎么做关键词分析软件
  • php手机网站开发网站运营推广方式
  • 北京网站建设 网站维护互联网营销师培训
  • 佛山新网站制作平台兰州seo培训
  • 网站建设需要写代码吗淘宝推广方法有哪些
  • 网站排名消失网红推广
  • 网站怎么做h5支付宝支付搜索百度app下载
  • 黄岩做网站公司电话企业推广app
  • 优惠券网站怎么做搜索引擎营销有哪些方式
  • 一级a做爰片免费网站瑜伽怎么自己创建一个网站
  • 兴仁县城乡建设局网站seo是什么公司
  • xampp wordpress linux深圳企业seo
  • 重庆公司注册代理seo推广骗局
  • 建筑网建筑规范大全专业网站优化外包
  • 常州注册公司代办注册烟台seo外包