Taro: 微信小程序支持自定义 tabbar 了,Taro是否也要支持下?

Created on 22 Jan 2019  ·  12Comments  ·  Source: NervJS/taro

微信小程序目前已经支持自定义 tabbar 组件了,但是需要在根目录下添加下面四个文件

custom-tab-bar/index.js
custom-tab-bar/index.json
custom-tab-bar/index.wxml
custom-tab-bar/index.wxss

我在src根目录新建 custom-tab-bar 文件夹,并新增index.js和index.less文件,但是并没有编译,这个需要怎么处理?

https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html

enhancement

Most helpful comment

请问hooks写法,在组件里如何拿到自定义tabbar的组件实例呢,如何获取getTabBar

All 12 comments

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

CC @luckyadam

近期会支持到

同求

这个要如何使用, 有没例子? 我只设置了custome:true编译会报错:

编译  组件文件  src/custom-tab-bar
(node:367032) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'pages' of undefined
    at buildPages (C:\Users\gz000069\AppData\Roaming\npm\node_modules\@tarojs\cli\src\weapp.js:1190:27)
    at Object.build (C:\Users\gz000069\AppData\Roaming\npm\node_modules\@tarojs\cli\src\weapp.js:2217:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
(node:367032) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:367032) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
{ Error: ENOENT: no such file or directory, open 'C:\Users\Documents\WeChat Files\fhjjvfdff\Files\taroConverte\src\custom-tab-bar'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at buildSingleComponent (C:\Users\gz000069\AppData\Roaming\npm\node_modules\@tarojs\cli\src\weapp.js:1737:31)
    at buildCustomTabbar (C:\Users\gz000069\AppData\Roaming\npm\node_modules\@tarojs\cli\src\weapp.js:1090:9)
    at buildEntry (C:\Users\gz000069\AppData\Roaming\npm\node_modules\@tarojs\cli\src\weapp.js:1137:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\Users\\Documents\\WeChat Files\\fhjjvfdff\\Files\\taroConverte\\src\\custom-tab-bar' }
编译  所有页面  

@gclsoft 在 src 目录下新建 custom-tab-bar 目录存放组件即可,app.json 的配置参考微信小程序文档。

image

@gclsoft 在 src 目录下新建 custom-tab-bar 目录存放组件即可,app.json 的配置参考微信小程序文档。

image

小哥。你这个方式我试了一下。Taro 报警告了⚠️。

image

image
这是报错

image
编译的目录

请问hooks写法,在组件里如何拿到自定义tabbar的组件实例呢,如何获取getTabBar

请问hooks写法,在组件里如何拿到自定义tabbar的组件实例呢,如何获取getTabBar

请问hooks写法,在组件里如何拿到自定义tabbar的组件实例呢,如何获取getTabBar

同问

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LadyChatterleyLover picture LadyChatterleyLover  ·  3Comments

zhuxianguo picture zhuxianguo  ·  3Comments

deepcoldy picture deepcoldy  ·  3Comments

wyhaya picture wyhaya  ·  3Comments

leafchao picture leafchao  ·  3Comments