Open wxwebfeng opened 2 months ago
const infos = ref<Info[]>([]);
You need to convert infokey
and Info
into an Info[]
array based on your own judgment criteria.
Or render separately:
<template v-if="Array.isArray(data)">
<div v-for="item in data" :key="item.id">{{ item.id }}</div>
</template>
<template v-else>
<div v-for="(val, key) in data" :key="val.id">{{ val.id }}</div>
</template>
const data = ref<InfoList | InfoObj[]>([])
This should be in the scope of language tools and how v-for
codegen works. Transferring over.
I'm seeing similar things.
I'm in a VS Code Remote session
I've started seeing this error yesterday. Could it be related?
Rolling back Vue Official to 2.1.6 fixed it for me
@wxwebfeng upgrading to v2.1.10 fixed my issue. is yours resolved?
Vue version
3.5.0
Link to minimal reproduction
https://play.vuejs.org/#eNp9U81u00AQfpVhL0lRyH96CE4kQJUIohQBEodsDq69Tja1d63ddUjlWkICqRckroCExIVzX6CoL0NLeAvGayckEvRizXzzzef525Q8iOP6ImGkTxztKR4b0MwkMYSumA4oMZqSIRU8iqUykIIUhzIRhvmQQaBkBBVMrtzfYigW1PDjeoYv2A6LCqRhrgpcj8HIsAhSKgC43weRRMdMwRloo7iYUpHtcEUgj47nBX18wk77JW/StzqWbk7jgvmUawMDGxhPqPCkQD/SU8SwuGrlMQtDCa+lCv07lT0qGg1YXX3+ff7h+uPF6t2Pm08XECsZa/h5+W11dX7z9fuvL++v317CWst3jVuIOZv/na2LHFbHExSFfI6jvIOFG1arezAYFuUDFCLYMWocumZWD0IpVdWayhW+jJB+F1pNK4PzCaCas4eDHuytRcBWUUfxhKHOBgUwfUjzkbZaWW0LbZdwu70Dd0q408ERFlhpZMBCzf7zv7FN6nazmjV6vdLY389w5BuVrAadZjNvxGkU54XHhA6uJg5dw9ADcGatYZraDWWZ00DPoj5fwOJeIBWeIc+PhQtbAyXQxxMo0Tr3EcD80skVMBMlnMbWX0gNTxkHH/Bpfa6lwHu3jVHiySjmIVNHseG4GEpwIEUHlLh4KG+eWMyohJVzw5wZ807+gc/1Mscoea6Yxs0zSjYx46opM0X44OUztkR7E4ykn4TIviX4gmkZJnmNBe1hInwse4tnqx3Zd4hP45U+WBom9LqpvNBiJUXf+CIf3dL633I79a7Nw0dGsj/zRmUR
Steps to reproduce
将v-for 的类型 设置为 数组对象 或者 对象嵌套 对象, 出现 类型为 unknown 情况
What is expected?
期望 能够 推断出其类型 , 就是上面用例中的 Item
What is actually happening?
其实给出了 类型为 unknown
System Info
No response
Any additional comments?
No response