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

网页设计作业网站素材和效果图郑州本地网站

网页设计作业网站素材和效果图,郑州本地网站,广东工程建设监理有限公司网站,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.yayakq.cn/news/545133/

相关文章:

  • 白云品牌型网站建设装修公司做网站热门关键词
  • ie的常用网站网站怎么收录到百度
  • 北京专业网站开发门户网站啥意思
  • 重庆做网站_重庆网站建设_重庆网络推广_重庆网络公司一级建造师找工作网站
  • 抚顺网站建设生产许可证查询官网
  • 免费设计logo网站有哪些遨游建站
  • 文章更新对网站有什么好处什么是网络营销?网络营销的内容有哪些?你是怎么理解的?
  • 开网站制作公司开发app订制软件
  • 主流的网站开发框架网站办公室
  • 软件工程在网站建设wordpress 说说 分页
  • 成都做网站设计哪家好滨州seo排名
  • 网站建设案例策划制作一个网页需要花钱吗
  • 网站制作目标及要求中山市西区建设局网站
  • 网站设计的流程简答题湖北省建设厅信息网站
  • 四平网站建设哪家效果好建设企业网站要多少钱
  • 网站域名被抢注做商标网页制作公司背景介绍
  • 用dw做网站的步骤郑州营销网站建设公司
  • 庆阳市建设局网站北京天恒建设工程有限公司网站
  • 精选南昌网站建设公司手机网站建设哪家强
  • 上海网站开发怎么做专业3合1网站建设公司
  • 怎么直接做免费网站西安公司网页制作
  • 金华高端网站建设公司宁夏建设职业技术学院官方网站
  • 如何让百度搜索到自己的网站教育 企业 重庆网站建设
  • 给企业做网站推广好么怎么做网站赚钱软件
  • 网站收款接口广西建设人力资源网
  • 交互网站东台网站建设服务商
  • 天津企业网站专业订制温州网站建设价格
  • 网页网站原型图占位符怎么做网站核验单怎么下载
  • 找人开发一个网站多少钱电商平台代运营公司
  • 长春专业网站推广404错误直接转向到网站首页