当前位置:   article > 正文

uni-app实现底部导航栏以及会遇到的bug解决办法_uniapp 购物车悬浮在底部

uniapp 购物车悬浮在底部

我们先来看一下效果:

我们只需要在pages.js配置一下即可:

  1. "pages": [
  2. { // 首页
  3. "path": "pages/index/index",
  4. "style": {
  5. "enablePullDownRefresh": true,
  6. "navigationBarBackgroundColor": "#fff",
  7. "navigationBarTextStyle": "black",
  8. "backgroundColorTop": "#F7F7F7",
  9. "backgroundColorBottom": "#F7F7F7",
  10. "onReachBottomDistance": 50,
  11. "navigationStyle": "custom",
  12. "app-plus": {
  13. "titleNView": false,
  14. "pullToRefresh": {
  15. "support": true,
  16. "color": "#fa436a",
  17. "style": "default"
  18. }
  19. }
  20. }
  21. },
  22. { // 分类
  23. "path": "pages/classify/classify-index/index",
  24. "style": {
  25. "navigationBarTitleText": "分类",
  26. "onReachBottomDistance": 50,
  27. "app-plus": {
  28. "bounce": "none",
  29. "titleNView": false
  30. }
  31. }
  32. },
  33. { // 消息
  34. "path": "pages/notify/notify-index/index",
  35. "style": {
  36. "enablePullDownRefresh": true,
  37. "navigationBarTitleText": "消息中心",
  38. "app-plus": {
  39. "bounce": "none",
  40. "pullToRefresh": {
  41. "support": true,
  42. "color": "#fa436a",
  43. "style": "default"
  44. }
  45. }
  46. }
  47. },
  48. { // 购物车
  49. "path": "pages/cart/index",
  50. "style": {
  51. "enablePullDownRefresh": true,
  52. "navigationBarTitleText": "购物车",
  53. "navigationBarTextStyle": "black",
  54. "app-plus": {
  55. // "titleNView": false,
  56. // "softinputNavBar": "none",
  57. // 禁用原生导航栏
  58. "pullToRefresh": {
  59. "support": true,
  60. "color": "#fa436a",
  61. "style": "default"
  62. }
  63. }
  64. }
  65. },
  66. {
  67. "path": "pages/my/my-index/index",
  68. "style": {
  69. "navigationBarTitleText": "我的"
  70. }
  71. }
  72. ],
  73. "tabBar": {
  74. "color": "#C0C4CC",
  75. "selectedColor": "#fa436a",
  76. "borderStyle": "black",
  77. "backgroundColor": "#ffffff",
  78. "list": [{
  79. "pagePath": "pages/index/index",
  80. "iconPath": "static/tabBar/tab-home.png",
  81. "selectedIconPath": "static/tabBar/tab-home-rf.png",
  82. "text": "首页"
  83. },
  84. {
  85. "pagePath": "pages/classify/classify-index/index",
  86. "iconPath": "static/tabBar/tab-cate.png",
  87. "selectedIconPath": "static/tabBar/tab-cate-rf.png",
  88. "text": "分类"
  89. },
  90. {
  91. "pagePath": "pages/notify/notify-index/index",
  92. "iconPath": "static/tabBar/tab-notify.png",
  93. "selectedIconPath": "static/tabBar/tab-notify-rf.png",
  94. "text": "消息"
  95. },
  96. {
  97. "pagePath": "pages/cart/index",
  98. "iconPath": "static/tabBar/tab-cart.png",
  99. "selectedIconPath": "static/tabBar/tab-cart-rf.png",
  100. "text": "购物车"
  101. },
  102. {
  103. "pagePath": "pages/my/my-index/index",
  104. "iconPath": "static/tabBar/tab-my.png",
  105. "selectedIconPath": "static/tabBar/tab-my-rf.png",
  106. "text": "我的"
  107. }
  108. ]
  109. }

不要存在

  1. // #ifdef MP
  2. // #endif

判断语句,不然会报错

还有就是启动页要和首页路径保持一致

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/131580?site
推荐阅读