rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Fragment component

Open CyberAP opened this issue 3 years ago • 2 comments
trafficstars

Summary

Add a fragment built-in component to allow conditional transparent wrapping.

Examples

Conditional wrapper component

<template>
  <WrapperComponent v-if="shouldWrap">
    <img src="cat.jpg" alt="Cat" />
  </WrapperComponent>
  <img v-else src="cat.jpg" alt="Cat" />
</template>

fragment component

<template>
  <component :is="shouldWrap ? WrapperComponent : 'fragment'">
    <img src="cat.jpg" alt="Cat" />
  </component>
</template>

Links


Important: Do NOT comment on this PR. Please use the discussion thread linked above to provide feedback, as it provides branched discussions that are easier to follow. This also makes the edit history of the PR clearer.

CyberAP avatar May 17 '22 13:05 CyberAP

here I have the same problem.
https://github.com/vuejs/core/issues/3092

pangao66 avatar May 24 '22 02:05 pangao66

@pangao66 will be better to keep comments in discussion thread

Important: Do NOT comment on this PR. Please use the discussion thread linked above to provide feedback, as it provides branched discussions that are easier to follow. This also makes the edit history of the PR clearer.

unrevised6419 avatar May 24 '22 06:05 unrevised6419