You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the official use case, when defining components using defineComponent, an example of using generics is as follows:
constComp=defineComponent(<Textendsstring|number>(props: {msg: T;list: T[]})=>{// use Composition API here like in <script setup>constcount=ref(0)return()=>{// render function or JSXreturn<div>{count.value}</div>}},// manual runtime props declaration is currently still needed.{props: ['msg','list']})
I know that generic can be used to define in composite APIs, but child components and parent components are defined by defineComponent, so I want to know how to pass generic from the parent component in tsx###
Vue version
3.4.27
Link to minimal reproduction
https://play.vuejs.org/#eNp9U02PmzAQ/StTX2AlBFLbU5Yg9WOldg9ttY3UQ4i0CCYJu2BbtklTIf57x8aQ7DZNDsTz4Zk374179kHK+NAhW7BUl6qWBjSaTmY5r1splIEeFG5hgK0SLQSUGsyhz9gK748Ta8RGHylcCq4NtHoHS3s5DL5g0wj4JVRTvQlucp7zNBm7UR8yDLayKQySBZC6sgmd0+QswCJmNFXe1rv4SQtOiHubnrNStLJuUH2XpqbOOVuAi9hYQY1/3zufUR1Gk7/cY/l8wf+kj9aXsx8KNaoD5myOmULt0Izhu5/f8EjnOdiKqmso+0rwAbVoOotxTPvY8Ypgn+U5tF8duTXfrfTd0SDX01AWqM0cXH7OSItPV0Y/wX0Xv3f3cj4Qi5NQROAscYXbmrtqgiM30bnmrlHObmfZbdosuzW87JPwTr/l65pheAPLbII3ZjY1fcYdWY9+IDC8aHEBwUq0gZ/1hf++KJ9PgY1bJ3tStLeKw4s2xIP/99G0qg9uy+wvteDSqbA2ikiHIbObu8zZ3i5tzhzIZW+/8aFoOhzcbvoKyake0UsfBwePjihioOiakRAifqLqCvGv3tnEqGP8X0bda1kB7RrySsMDlkJV6ThHBAX/k2WhVEJq2go71DTjrZtpAav1hgB7uk66iAbjRuzCR5v1GIErEVuDhvs/0xcZ3r/N+vE+9R/ShOxZ0OkAZx3itpAh7UQGqcx6E1tp6JrMfGtP82Xu3Ur4sn7udUB9gwgCWzzY+GdwSSRLKxv+Ai3howE=
Steps to reproduce
In the official use case, when defining components using
defineComponent
, an example of using generics is as follows:I know that
generic
can be used to define in composite APIs, but child components and parent components are defined by defineComponent, so I want to know how to pass generic from the parent component in tsx###What is expected?
like react, we can pass generics like this:
What is actually happening?
I couldn't find any way to pass generics into child components,like this
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: