在小程序中使用下拉菜單組件的時候,會顯示出好幾個警告:slot "" is not found (for component "miniprogram_npm/@vant/weapp/popup/index);查看miniprogram_npm中的popup組件里面有默認slot,但是因為wx:if 初始值為false導致初始解析時跳過,所以會彈出警告,解決辦法再下面加個wx-else的默認插槽;如下:
<view
wx:if="{{ inited }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}"
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}"
bind:transitionend="onTransitionEnd"
>
<slot />
<van-icon
wx:if="{{ closeable }}"
name="{{ closeIcon }}"
class="close-icon-class van-popup__close-icon van-popup__close-icon--{{ closeIconPosition }}"
bind:tap="onClickCloseIcon"
/>
</view>
//添加默認插槽
<view wx:else style="display: none;">
<slot></slot>
</view>