关键帧在MUI样式的组件中不起作用

时间:2020-07-02 05:00:50

标签: reactjs material-ui styled-components jss

我正在尝试使用MUI内置的样式化组件实现(在外部库上实现之前)为图像(img标签)创建无限旋转。

这是我的代码片段。如果我正在运行它,则会出现错误。

export const SearchPreloaderContainerDiv = styled('div')({
  margin: '0 auto',
  display: 'flex',
  flexDirection: 'column',
  alignItems: 'center',
  flex: 1,

  '& h4': {
    margin: '50px 0 0 0',
    color: '#282828',
    fontFamily: 'Cuprum',
    fontStyle: 'normal',
    fontSize: '43px',
    lineHeight: '70px',
  },

  '@keyframes loader': {
    from: {
      transform: 'rotate(0deg)',
    },
    to: {
      transform: 'rotate(360deg)',
    },
  },

  '& img': {
    padding: '20px',
    boxSizing: 'border-box',
    animation: 'loader linear 3s infinite',
  },
});

enter image description here

在使用外部样式的Componet库中的关键帧帮助器实现之前,现在我在MUI中找不到类似的帮助器

0 个答案:

没有答案