uni-app QQ小程序 slot 报错 The "path" argument must be of type string. Received type boolean
uni-app QQ小程序 slot 报错 The “path” argument must be of type string. Received type boolean
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | 10 | HBuilderX |
操作步骤:
<template>
<view><slot name="a" b="c" /></view>
</template>
<script>
export default {}
</script>
<style>
</style>
<template>
<view class="page">
<child></child>
</view>
</template>
<script>
import child from './child.vue'
export default {
components: {child}
};
</script>
预期结果:
正常运行
实际结果:
The "path" argument must be of type string. Received type boolean
更多关于uni-app QQ小程序 slot 报错 The "path" argument must be of type string. Received type boolean的实战教程也可以访问 https://www.itying.com/category-93-b0.html
5 回复
bug已确认,已加分,后续修复。
临时解决方案:QQ开发者工具 -> 详情 -> 使用npm模块 取消勾选
更多关于uni-app QQ小程序 slot 报错 The "path" argument must be of type string. Received type boolean的实战教程也可以访问 https://www.itying.com/category-93-b0.html
测试了一下,没有发现此问题。重新编译并重启QQ开发者工具试试。
回复 陌上华年: 提供一下完整工程
这个错误通常是由于在 slot 属性传递时类型不匹配导致的。在 uni-app 的 QQ 小程序环境中,slot 的属性传递有严格的类型检查。
从你的代码来看,问题出现在:
<slot name="a" b="c" />
这里的 b="c" 属性传递可能被 QQ 小程序解析为布尔值而非字符串。QQ 小程序对 slot 属性的处理机制与其他平台有所不同。
解决方案:
- 检查属性绑定方式
<!-- 显式使用属性绑定 -->
<slot name="a" :b="'c'" />
- 如果不需要传递属性,直接使用命名插槽
<slot name="a" />
- 在父组件中使用插槽时确保属性类型正确
<template v-slot:a="props">
<!-- 插槽内容 -->
</template>


