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

定期做图书推荐的网站南宁做网站

定期做图书推荐的网站,南宁做网站,动画片是怎么制作出来的,wordpress装修最终效果 最近在用Taro框架开发一个小程序#xff0c;有一个自定义底部Tabbar的需求#xff0c;最终效果如下 起步 这页是我第一次接触自定义小程序底部Tabbar#xff0c;所有第一选择必然是相看官方文档#xff1a;微信小程序自定义 Tabbar | Taro 文档 #xff08;如果…最终效果 最近在用Taro框架开发一个小程序有一个自定义底部Tabbar的需求最终效果如下 起步 这页是我第一次接触自定义小程序底部Tabbar所有第一选择必然是相看官方文档微信小程序自定义 Tabbar | Taro 文档 如果第一次做请一定要仔细看这个文档 按照文档正常配置app.config.js app.config.js export default {tabBar: {custom: true,color: #000000,selectedColor: #000000,backgroundColor: #000000,list: [{pagePath: page/home/index,text: 组件,},{pagePath: page/cart/index,text: 接口,},],}, }配置tab页面usingComponents page/home/index.config.js export default {navigationBarTitleText: 教材,usingComponents: {}, }page/cart/index.config.js export default {navigationBarTitleText: 购物车,usingComponents: {}, } 开发 custom-tab-bar 设置 custom-tab-bar 组件 component: true  Demo import { Component, useState } from react; import { CoverImage, CoverView } from tarojs/components import clx from classnames import Taro from tarojs/taro; import { View } from tarojs/components; import ic_book from /static/images/ic_book2x.png; import ic_car from /static/images/ic_car2x.png; import ic_bookHover from /static/images/ic_book_hover2x.png; import ic_carHover from /static/images/ic_car_hover2x.png; import ./index.scss; function CustomTabBar() {const [tab, setTab] useState({color: #000000,selectedColor: #DC143C,list: [{pagePath: /pages/home/index,text: 教材,iconPath: ic_book,selectedIconPath: ic_bookHover},{pagePath: /pages/shopping-cart/index,text: 购物车,iconPath: ic_car,selectedIconPath: ic_carHover}]});function switchTab(index, url) {nx.$patch(app/setTabIndex, index);Taro.switchTab({ url });}return (CoverViewclassNametab-barstyle{{ height: nx.$get(app.tabHeight) px }}CoverView classNametab-bar-border/CoverView{tab.list.map((item, index) {return (CoverViewkey{index}classNametab-bar-itemonClick{() switchTab(index, item.pagePath)}CoverView classNameraCoverImageclassNamecover-imagesrc{nx.$use(app.tabIndex) index? item.selectedIconPath: item.iconPath}/{index 1 (CoverView className{clx(null-dot, {dot: nx.$use(cart.count),})}{nx.$use(cart.count)}/CoverView)}/CoverViewCoverViewclassNamecover-viewstyle{{color:nx.$use(app.tabIndex) index? tab.selectedColor: tab.color}}{item.text}/CoverView/CoverView);})}/CoverView); } export default CustomTabBar;注意点 上述代码中出现的nx是我同事基于Redux Toolkit 封装的一个语法糖你可以忽略直接理解为你自己全局状态的使用 修复自定义tab点击卡顿、闪烁 请在每个tab页面中调用如下代码更新tab home const page useMemo(() Taro.getCurrentInstance().page, []);useDidShow(() {const tabbar Taro.getTabBarany(page);tabbar?.setSelected(0); }); cart const page useMemo(() Taro.getCurrentInstance().page, []);useDidShow(() {const tabbar Taro.getTabBarany(page);tabbar?.setSelected(1); }); 以上就是我自定义tab的大致过程详细细节还需要你自己去看文档官方有相关示例只要有耐心你一定可以做的更好 已下是Taro官方的示例  react:  https://github.com/NervJS/taro/tree/main/examples/custom-tabbar-react vue  https://github.com/NervJS/taro/tree/main/examples/custom-tabbar-vue3
http://www.pierceye.com/news/787946/

相关文章:

  • 保定网站推广费用网站搜索 收录优化
  • 三河市建设厅公示网站个人flash网站
  • 建设网站工具上海网站制作团队
  • 化妆品网站系统规划wordpress 站群软件
  • 深圳低价做网站广告免费设计在线生成
  • 网站服务体系网站开发补充合同范本
  • 萝岗做网站网站优化大计
  • 服装店网站模板北京网站设计公司哪个好
  • 网站运维工作内容网页设计与制作课程小结
  • 2019网站怎么做网站快速备案公司
  • 上饶网站制作专业网站设计如何提升网页品质
  • 哈尔滨微信网站建设学网站设计和平面设计
  • 网站开发公司网站官网焦作建设企业网站公司
  • 设备上哪个网站做外贸推广php版本不同于wordpress使用
  • 虚拟服务器怎样做网站广州 骏域网站建设专家
  • 谁有做任务网站色多多导入百媚导航
  • 做网站怎么加视频素材网免费
  • 想做棋牌网站怎么做做电商的进货网站
  • 做微信小程序和做网站南昌网站备案
  • 好的摄影网站推荐抖音点赞自助网站
  • 能够做代理的网站有哪些问题朝阳区住房和城乡建设部网站
  • 网站建设与管理考察报告中国农业建设信息网站
  • 张家界做网站中天建设集团有限公司怎么样
  • 广州网站百度排名推广聊天代理分销系统
  • 全球采购网站有哪些网站平台
  • wordpress怎么做商城网站软件工程师证书含金量
  • 锡林浩特建设局网站推广方法有哪几种
  • 汉南城乡建设局网站活动页面设计
  • 滕州网站搜索引擎优化新浪企业邮箱
  • 涿州网站建设珠海网站制作计划