“再加速”
问题
警告:slot “” is not found (for component xxx),但不影响功能使用
环境
- 微信开发者工具:1.05.2204180
- 基础库:2.24.0
- vant-weapp:1.10.2
问题原因
根据微信官方文档说明,可以推测出是由于以下代码导致<slot />
没有被解析,从而导致警告的出现
<view wx:if="{{ inited }}">
...
<slot />
</view>
解决方法
在使用的组件中加入以下代码,强制解析<slot />
<view wx:else style="display:none">
<slot />
</view>
参考:
https://developers.weixin.qq.com/miniprogram/dev/reference/wxml/conditional.html
https://blog.csdn.net/weixin_43954962/article/details/122563524
https://github.com/youzan/vant-weapp/issues/4815#issue-1156193588