【问题标题】:appBar iconStyleRight syntax errorappBar iconStyleRight 语法错误
【发布时间】:2016-01-17 03:15:31
【问题描述】:

我有

render() {
    return <AppBar style={{ position: "fixed" }} title={<span>my Title</span>}

        iconElementLeft={<IconButton><NavigationMenu /></IconButton>}
        iconStyleRight={{color:"red"}}
        iconElementRight={<IconButton><span className = "material-icons">account_circle</span></IconButton>}
        />
}

但是 iconStyleRight 给了我错误

Type '{ [x: number]: undefined; color: any; }' is not assignable to type 'string'

不知道为什么。我尝试了很多组合,包括将style 添加到&lt;span&gt; 元素,它被忽略了。

希望正确的语法使这个正确的图标显示为红色,以便我了解如何将样式应用于我的图标。

【问题讨论】:

    标签: material-ui


    【解决方案1】:

    原来解决办法是设置IconButton组件的iconStyle属性。

    另外,在我当前在 material-ui.d.ts 中的环境中,iconStyleRight 属性的 typedef 被错误地设置为“字符串”,但应该是对象,从而使问题更加复杂。

    现在一切都好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-05
      • 2021-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-16
      相关资源
      最近更新 更多