在我们成功跑起来以后就可以使用taro开发自己的项目了,首先肯定是先整理项目结构目录

首先我们进入app.jsx中,这里是整个程序的入口,这里渲染的首页是一个Index的组件。
下面安装taro-ui
yarn add taro-ui
在index.jsx中应用组件,在相应的scss文件中引入样式文件
在index.jsx中引入头部导航和底部tabBar,这是一种以index为根路由的方式,不是很适合小程序

比较适合小程序的是在app.jsx中,在config对象中进行tabBar的配置,这里以微信小程序为例:

这里的position是为了让tabBar在上方,这时是不显示图标的,新建的页面也必须在config的peages数组中进行引用,这样一来,首页还有一个简单的导航就已经完成了
网友评论