Vue3中v-for循环遍历引入的组件为何未能加载?-灵析社区

看数据的中二丸子头

将组件本身传递给 is 而不是其名称,则不需要注册: import OneCom from './one-com.vue' import { ref, markRaw } from 'vue' const comList = ref([{ id: 1, comName: markRaw(OneCom) }]) 如果想通过名称传递则必须先对其进行注册: import OneCom from './one-com.vue' import { defineComponent, ref } from 'vue' const comList = ref([{ id: 1, comName: 'OneCom' }]) export default defineComponent({ components: { OneCom } })

阅读量:1

点赞量:0

问AI