材质用户界面:默认样式已从SSR项目中完全删除

时间:2019-11-09 06:42:07

标签: reactjs material-ui

next.js 9.1.3项目中的MUI组件中没有默认样式。但是,其他库(Polaris)的样式仍然有效。

enter image description here

我正在使用Material-UI v4.6.0,React 16.10.1,Chrome 78和TypeScript 3.7.2。这是我的测试组件

import AppBar from "@material-ui/core/AppBar";
import ToolBar from "@material-ui/core/Toolbar";
import Paper from "@material-ui/core/Paper";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
import Button from "@material-ui/core/Button";


 ////// Render //////
 return (
  <React.Fragment>
    <Paper>
      <Tabs
        value={selectedTab}
        onChange={(event, newValue) => setSelectedTab(newValue)}
        indicatorColor="primary"
        textColor="primary"
      >
        <Tab label="Rules" value="rules" />
        <Tab label="Open / Issue Tickets" value="openIssue" />
        <Tab label="Closed Tickets" value="closed" />
        <Tab label="Settings" value="settings" />
      </Tabs>
    </Paper>

    <BottomMarginSpacer />

    <p>
      <PolarisButton>Polaris Button</PolarisButton>
    </p>

    <p>
      <Button variant="contained" style={{color: "red"}}>Material UI Button</Button>
    </p>
  </React.Fragment>
 )
}

0 个答案:

没有答案