【vue3 + vite】: Invalid VNode type: undefined (undefined)
在使用 vue3 注册全局组件的时候,使用 app.component 注册组件在使用的时候会报:Invalid VNode type: undefined (undefined) 的错误。
const components = import.meta.glob("../components/form/*.vue");
function autoRegisterComponents(app: App) {Object.entries(components).forEach(([file, module]) => {const name = file.split("/").pop()?.replace(/.vue/, "") as string;app.component(name, module);});
}
解决:
引入 defineAsyncComponent(定义一个异步组件,它在运行时是懒加载的。参数可以是一个异步加载函数,或是对加载行为进行更具体定制的一个选项对象。)
import { App, defineAsyncComponent } from "vue";const components = import.meta.glob("../components/form/*.vue");
function autoRegisterComponents(app: App) {Object.entries(components).forEach(([file, module]) => {const name = file.split("/").pop()?.replace(/.vue/, "") as string;app.component(name, defineAsyncComponent(module));});
}
【vue3 + vite】: Invalid VNode type: undefined (undefined)相关推荐
- Invalid vnode type when creating vnode: undefined. vue 3.2版本错误解决
Invalid vnode type when creating vnode: undefined. 主要是因为引入组件的时候,变量名没有首字母大写 import winVue from " ...
- 【Vue3.0】Vue3.0简介-指令-过滤器-案例D2.0
[Vue3.0]Vue3.0简介-指令-过滤器-案例 一.Vue3.0简介 1.1.vue3.0与vue2.0对比 vue2.0中绝大多数的API与特性,在vue3.0中同样支持.但是vue3.0中新 ...
- 【Vue3.0】—V- model‘ directives require no argument.
[Vue3.0]-V- model' directives require no argument. 虽然项目可以运行,但是看着很不舒服! 解决办法 VSCode-文件-首选项-设置 进入JSON文件 ...
- 【vue警告坑】 Invalid prop: type check failed for prop resultChild. Expected Object, got String with v
[Vue warn]: Invalid prop: type check failed for prop "resultChild". Expected Object, got ...
- 【Vue3+Vite+TS项目集成ESlint +Prettier实现代码规范检查和代码格式化】
目录 前言 创建项目 安装初始化ESlint 安装ESlint: 初始化ESlint: 安装配置Prettier 安装prettier: 配置prettier: 配置VScode保存时自动格式化代码 ...
- 【Vue3+vite+Element-UI Plus 】
1 Vue3 + vite + Element-UI Plus 全局配置 在终端中利用命令 npm init vite-app 项目名称 ,创建基于 vite 的 vue3 项目 利用命令 npm i ...
- vue3使用箭头函数导入异步组件报错Invalid VNode type: undefined的解决方案
import { defineAsyncComponent } from 'vue'export default {components: {Header: defineAsyncComponent( ...
- [Vue warn]: Invalid VNode type: undefined
记录一个找了很久的问题:一般出现这种状况很有可能是(某个customRender有问题) customRender的动态变化也是组件,customRender有问题 排查方法在你要返回的columns ...
- 【C++ grammar】Enhancement for Type System (C++11 对类型系统的增强)
数据类型 (Data type) int, long int, double, struct, char *, float [], int (*f)()- 计算机程序构造块 计算机程序构造块是不同大小 ...
最新文章
- 如何在Github上精准地找到想要的开源项目?
- Python Xml类
- 【Android 逆向】启动 DEX 字节码中的 Activity 组件 ( 使用 DexClassLoader 获取组件类失败 | 失败原因分析 | 自定义类加载器没有加载组件类的权限 )
- 如何给 SAP Spartacus Storefront 创建新的页面
- oracle ebs 数据源,Oracle EBS环境下查找数据源(Form篇)
- Win10安装 WSL Ubuntu Linux系统,非双系统,完美兼容超详细版本
- 小觅双目相机如何使用_MYNT EYE S小觅双目摄像头标准(彩色)版结构光双目深度惯导相机3D...
- 写给对前途迷茫的朋友:五句话定会改变你的人生
- 关于操作系统设计的基本原理和设计原则
- 搭建机器人电控系统——什么是单片机MCU?如何选择单片机?
- IDEA中springboot项目启动慢
- python中数组常用的统计方法
- 【论文笔记】Semantic Parsing on Freebase from Question-Answer Pairs
- ECCV 2022|计算机视觉中的长尾分布问题还值得做吗?
- 数字孪生是什么,数字孪生能干什么?一文读懂
- 笔记本无法搜索到WiFi问题
- CFile用法与实现
- H7N9?生活还得继续~~适合边玩边学的HTML5五彩连珠游戏 1
- csgo哪个hvh服务器可以无限热身,hvh(csgo国服hvh服怎么进)
- python_pyecharts画三维折线图