xiaoxiao昱
xiaoxiao昱
  • 发布:2021-10-29 10:20
  • 更新:2021-10-29 11:50
  • 阅读:866

【报Bug】重大问题:uniapp集成vue3后,wx.createComponent编译不出来

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows11 21H2

第三方开发者工具版本号: 微信开发者工具 1.05.2110110

基础库版本号: 2.19.1

项目创建方式: CLI

CLI版本号: @vue/cli 4.5.12

操作步骤:

添加带自定义插槽的组件:

TodoList.vue

<template>  
<ul>  
  <li v-for="( item, index ) in items">  
    <slot :item="item" :index="index"></slot>  
  </li>  
</ul>  
</template>  

<script>  
export default {  
  props: {  
    items: {  
      type: Array,  
      required: true  
    },  
  }  
}  
</script>  

<style scoped>  
a {  
  color: #42b983;  
}  
</style>

在页面中引入:

<template>  
<TodoList>  
  <template v-slot:default="{ item }">  
    <span class="green">{{ item?.name }}</span>  
  </template>  
</TodoList>  
</template>  

<script>  
import TodoList from './TodoList.vue'  
export default {  
  components: {  
    TodoList  
  },  
  data() {  
    return {  
      list: [  
        {  
          id: 1,  
          name: 'vue',  
          age: 18  
        },  
        {  
          id: 2,  
          name: 'react',  
          age: 20  
        },  
        {  
          id: 3,  
          name: 'angular',  
          age: 22  
        }  
      ]  
    }  
  },  
}  
</script>  

<style>  
</style>

运行 yarn dev:mp-weixin , 生成 index-todo-list-default , 里面包含 wx.createComponent 方法,控制台报错:

TypeError: wx.createComponent is not a function

预期结果:

wx.createComponent 方法生成成功,控制台不报错

实际结果:

控制台报错,且vendor.js无法生成wx.createComponent 方法

bug描述:

uniapp集成vue3后,wx.createComponent编译不出来(图一、图二)。以前集成vue2是可以的(图三)。

2021-10-29 10:20 负责人:无 分享
已邀请:
l***@qq.com

l***@qq.com - 恩姆..

看看你开发者工具的基础库版本

  • xiaoxiao昱 (作者)

    最新的,上面信息附上了,基础库版本号: 2.19.1,这个方法是uniapp编译的时候挂到wx上的,不是小程序自带的

    2021-10-29 13:48

该问题目前已经被锁定, 无法添加新回复