代码如上

- 发布:2020-07-12 15:49
- 更新:2020-07-14 12:01
- 阅读:1013
产品分类: uniapp/小程序/字节跳动
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win7
HBuilderX类型: 正式
HBuilderX版本号: 2.7.14
第三方开发者工具版本号: 头条开发工具1.9.4
基础库版本号: 1.66.0.70
项目创建方式: HBuilderX
操作步骤:
预期结果:
应该显示为函数
应该显示为函数
实际结果:
显示为string
显示为string
bug描述:
编译到头条小程序 父组件参数传递函数 子组件接收到为String 导致vue警告 运行不了(编译器版本v3)
示列
父组件
<template>
<demo :format="format"></demo>
</template>
<script>
export default {
methods:{
format(){
console.log(111)
}
}
}
</script>
子组件
<template>
<view>我是子组件</view>
</template>
<script>
export default {
props:{
format:{
type:Function,
default:(res)=>{}
}
},
mounted(){
console.log(typeof this.format) //在头条中显示为string 但在微信小程序和h5中 均显示类型为function
}
}
</script>
4 个回复
GUNDAM (作者)
顶上去!
GUNDAM (作者)
顶上去
GUNDAM (作者)
顶上去
DCloud_UNI_GSQ
部分小程序平台限制只能传递纯数据类型