Subscribe on changes!

`compiler-dom` create unexpected nodes with `v-for` + `v-slot`

avatar
Mar 29th 2021

This seems to be intentional. With or without v-slot determines whether it needs to be processed by the vFor transform, so in essence, they are treated differently. We can see the details here https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/src/transform.ts#L463-L465

avatar
Mar 29th 2021

Can we change this implement if this is not the design?

avatar
Mar 31st 2021

This should be by design, we need @yyx990803 input.

avatar
Apr 1st 2021

<template v-for="..." v-slot> generates code like createSlots({ ... }) since it's dynamically generated slots. In this case the codegen tree is the source of truth and the original AST is left untouched. We can technically adjust the behavior, but it will solely be for external tooling and actually risks breaking existing compiler logic. I think it's better to keep the behavior and special case it in Volar.