子组件代码(my-component)如下:

<template>
  <view class="dddd"></view>
</template>

实际渲染后如下: dddd没有在子组件最外层,反而多了一层嵌套,这肯定不是我们想要的结果。

<template>
<my-component>
  <view class="dddd"></view>
</my-component>
</template>

解决方案:

defineOptions(
    {
      name: 'punch-item',
      options: {
        virtualHost: true
      }
    }
)