繁体   English   中英

属性..在类型“IntrinsicAttributes &..”上不存在

[英]Property .. does not exist on type 'IntrinsicAttributes & ..'

我正在尝试将自定义道具添加到自定义样式组件:

interface Props {
  image?: string;
  title?: string;
  subtitle?: string;
  background?: string;
}

export function CardWide({
  image, title, subtitle, background
}: Props) {
  return (
    <CardContainer background={background}>

我通过的样式化组件背景如下所示:

interface Props {
  background?: string;
}

const Card = styled.div<Props>`
  display: flex;
  flex-direction: row;
  margin-top: 18px;
  width: 100%;
  min-height: 524px;
  background: ${props => props.background}

但是,我收到以下错误:

在此处输入图像描述

感觉就像我已经完成了我需要做的一切,但我不确定我错过了什么。

这个代码沙箱有帮助吗?

https://codesandbox.io/s/magical-butterfly-4jjo0n?file=/src/App.tsx:312-320

如果您需要更多帮助,请告诉我

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM