vantWeapp報錯警告slot "" is not found

在小程序中使用下拉菜單組件的時候,會顯示出好幾個警告: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>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容