在uni-app自定义组件中,使用具名slot时,如果节点不是scroll-view,就会多增加一次view节点,即使已经手动增加了,也会再增加异常,具体原因还不清楚。
情况1,直接使用组件
<CommonPage>
<template #content>
<IndexRenovation/>
</template>
</CommonPage>
![](https://img.haomeiwen.com/i2530160/b54857159bfd0789.png)
情况2,嵌套异常view
<CommonPage>
<template #content>
<view class="index">
<IndexRenovation/>
</view>
</template>
</CommonPage>
![](https://img.haomeiwen.com/i2530160/80162bdce1d4bc15.png)
情况3,使用scroll-view原生组件
<CommonPage>
<template #content>
<scroll-view height="100%" scroll-y lower-threshold="300">
<IndexRenovation/>
</scroll-view>
</template>
</CommonPage>
![](https://img.haomeiwen.com/i2530160/ad382b98bb6f9f88.png)
网友评论