1、 安装taro-ui (此处使用cnpm)

  cnpm install taro-ui

2、 全局引入样式 app.scss

  sass :@import "~taro-ui/dist/style/index.scss";

3、 使用tabBar组件中引入AtTabBar ,详情可查询官网:https://taro-ui.aotu.io/#/docs/tabbar

  import { AtTabBar } from 'taro-ui'
  @import "~taro-ui/dist/style/components/tab-bar.scss";

  npm run dev:h5启动项目报错:

  

  官网介绍如下,请先设置再运行,项目便可正常运行;

  

4、 调用AtTabBar组件

  

 

5、 路由跳转到对应的页面,需先在app.js中定义路径

  

  注意事项:1. url用绝对路径时需要在最开始加“/”;2. 在toolbar定义过的页面不能跳转;

  

以上便可实现tabBar路由跳转;

新手学习,望各位大神多多指教;

 

 

 

posted on 2019-02-18 11:11  久巷  阅读(5861)  评论(0编辑  收藏  举报