Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTabBarStyle:fail #9397

Closed
biluochun opened this issue May 25, 2021 · 1 comment · Fixed by #10658
Closed

setTabBarStyle:fail #9397

biluochun opened this issue May 25, 2021 · 1 comment · Fixed by #10658
Labels
bug Something isn't working F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Milestone

Comments

@biluochun
Copy link

相关平台

H5

浏览器版本: Chrome 62
使用框架: React

复现步骤

配置 app.config.ts

  tabBar: {
    color: '#999999',
    selectedColor: '#FF5E00',
    backgroundColor: '#FFFFFF',
    borderStyle: 'white',
    list: [
      {
        pagePath: 'pages/index/index',
        text: '首页',
      },
      {
        pagePath: 'pages/mine/index',
        text: '我的',
      },
    ],
  },

在app.ts调用

      Taro.setTabBarStyle({
        color: '#999999',
        backgroundColor: '#FFFFFF',
        borderStyle: 'white',
      });

期望结果

调用正常执行

实际结果

Uncaught (in promise) {errMsg: "setTabBarStyle:fail"}

环境信息

  Taro CLI 3.2.8 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 12.18.1 - C:\Program Files\nodejs\node.EXE       
      Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD

补充信息

在文件webpack:///./node_modules/@tarojs/taro-h5/src/api/tabBar/index.js内设置断点

export function initTabBarApis (_App = {}) {
  tabConf = _App.state.__tabs; // 这一行设置断点
  App = _App
}

发现断点没被触发。

@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels May 25, 2021
@Chen-jj Chen-jj added the bug Something isn't working label Jun 3, 2021
@cj0x39e
Copy link

cj0x39e commented Jun 7, 2021

由于 Taro H5 的组件是 Web Components,所以在 H5 端可以使用下面的方法实现你的需求。

const tabbar = document.getElementsByTagName('taro-tabbar')[0];
const updateConfig = {color: '#ff0000'};
// conf 是 taro tabbar 组件内部声明的 prop
tabbar.conf = {...tabbar.conf, ...updateConfig};

等我有空了来尝试修修这个 bug ...

@Chen-jj Chen-jj mentioned this issue Oct 28, 2021
@Chen-jj Chen-jj added this to the 3.3.15 milestone Nov 22, 2021
@Chen-jj Chen-jj linked a pull request Nov 22, 2021 that will close this issue
3 tasks
@ZakaryCode ZakaryCode added this to Done in H5 Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
H5
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants