【问题标题】:Props not passing can someone check it没有通过的道具可以有人检查吗
【发布时间】:2022-09-27 19:40:46
【问题描述】:

块引用

无法通过道具,

Parent component:
props: {
    data: {
      type: Object as PropType<FormatOrderItem>,
      default: () => {}
    }

现在,当我在子组件中尝试传递时,我得到类型错误你能帮我解决这个问题吗?

  <ElScrollbar>
    {Store.Record.map((item, index) => (
  <ResultItem status={form.status} key={index + \'_KEY\'} data={item} />
  ))}
  </ElScrollbar>

在 data={item} 处收到错误

TS2322:类型 \'{ 状态:0 | 2 | 1 |空 |不明确的;键:字符串; 值:{ id:字符串;用户名:字符串;联赛ID:号码;联赛名称: 细绳; homeId:号码; awayId:号码;比赛时间:数字;运动类型: 数字; ... 41 更多 ...;版本密钥:字符串; }; }\' 不可分配 输入 \'IntrinsicAttributes & Partial<{ data: FormatOrderItem; }> & 省略<Readonly<ExtractPropTypes<{ 数据:{ 类型: 道具类型;默认值:() => {}; };地位: { ...; }; }>> & VNodeProps & AllowedComponentProps & ComponentCustomProps,\"数据\">\'。 类型 \'IntrinsicAttributes & 上不存在属性 \'value\' 部分<{数据:FormatOrderItem; }> & 省略<Readonly<ExtractPropTypes<{ 数据:{类型:道具类型;默认值:() => {}; };地位: { ...; }; }>> & VNodeProps & AllowedComponentProps & ComponentCustomProps,\"数据\">\'。

<ElScrollbar>
{Store.Record.map((item, index) => (`enter code here`
<ResultItem status={form.status} key={index + \'_KEY\'} data={item} />
))}
</ElScrollbar>

    标签: typescript vuejs3 tsx


    【解决方案1】:
    The issue is fixed now. 
    
    I used props: {
        data: {
          type: Object as PropType<any>,
          default: () => {}
        }
    it worked fine.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-19
      • 2023-03-12
      相关资源
      最近更新 更多