大家晚上好,我的样式组件库有一个无法纠正的错误:
错误:您似乎正在插入关键帧声明(hVshE)
成一个未标记的字符串。 styled-components v3 支持这一点,
但 v4 不再支持,因为现在注入了关键帧
一经请求。请将您的字符串包装在 css`` 帮助器中,以确保
样式注入正确。看https://www.styled-components.com/docs/api#css https://www.styled-components.com/docs/api#css
错误是当我进行分配时:
const CardInner = keyframes`
flex: 1;
display: ${Card.display};
text-align: ${Card.textAlign};
transition: ${duration};
transform-style: preserve-3d;
${
Card.checkLimit && Card.checkLimitFlag
? css`
animation: ${tmp} ${duration} ${fillMode};
`
: Card.checkLimit === false && Card.checkLimitFlag
? css`
animation: ${tmp1} ${duration} ${fillMode};
`
: ""
}
`;
我该如何解决它?
您可以将标记的模板文字转换为等效的标记函数。
Source: 不将无穷大识别为有效关键字 #247 https://github.com/styled-components/stylelint-processor-styled-components/issues/247#issuecomment-525524944
const fadeIn = keyframes`...`
// EQUIVALENT TO: css`${fadeIn} 0.2s linear;`
const animationRule = css(
(['', ' 0.2s linear;'] as any) as TemplateStringsArray,
fadeIn
)
const StyledDiv = styled.div`
animation: ${animationRule}
`
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)