使用ivew-ui-plus 的Submit组件踩坑 injection “LoginInstance“ not found 记录 问题原因分析与解决方案

问题描述:

在下面这个页面中

注册按钮使用了view-ui-plusSubmit组件

结果控制台报错

bash 复制代码
runtime-core.esm-bundler.js:257 Uncaught TypeError: Cannot read properties of undefined (reading 'handleSubmit')
    at Proxy.handleSubmit (viewuiplus.min.esm.js:32610:26)
    at callWithErrorHandling (runtime-core.esm-bundler.js:195:19)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:202:17)
    at emit (runtime-core.esm-bundler.js:715:5)
    at Proxy.handleClickLink (viewuiplus.min.esm.js:6151:12)
    at callWithErrorHandling (runtime-core.esm-bundler.js:195:19)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:202:17)
    at HTMLButtonElement.invoker (runtime-dom.esm-bundler.js:693:5)

问题分析

顺藤摸瓜找到injection "LoginInstance" not found,看看代码,到底是哪里问题,没有用到LoginInstance这个组件啊

bash 复制代码
[Vue warn]: injection "LoginInstance" not found. 
  at <Submit onClick=fn<handleSubmit> > 
  at <FormItem> 
  at <IForm ref="formCustomRef" model= {deptId: '', account: '', password: '', confirmPassword: '', email: ''} rules= {account: Array(1), email: Array(2), deptId: Array(1), password: Array(1), confirmPassword: Array(1)}  ... > 
  at <Index onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > 
  at <Anonymous key="/register" vnode= {__v_isVNode: true, __v_skip: true, type: {...}, props: {...}, key: null, ...} route= {fullPath: '/register', hash: '', query: {...}, name: 'register', path: '/register', ...}  ... > 
  at <RouterView name=undefined route=undefined > 
  at <NuxtPage> 
  at <Login ref=Ref< undefined > > 
  at <LayoutLoader key="login" layoutProps= {ref: RefImpl} name="login" > 
  at <NuxtLayoutProvider layoutProps= {ref: RefImpl} key="login" name="login"  ... > 
  at <NuxtLayout> 
  at <App key=3 > 
  at <NuxtRoot>

翻了翻官方的文档,原来是这个问题

问题解决

<Submit>改为<Button>就OK了!

没有无缘无故的爱,也没有无缘无故的恨,凡事都有原因,一层层去扒,总会找到解决问题的办法哒!

相关推荐
__万波__1 小时前
二十三种设计模式(二十一)--状态模式
ui·设计模式·状态模式
zFox1 小时前
二、Kotlin高级特性以及Compose状态驱动UI
ui·kotlin·compose
leiming620 小时前
c++ QT 开发第二天,用ui按钮点亮实体led
开发语言·qt·ui
技术小甜甜1 天前
【Godot】【入门】信号系统从 0 到 1(UI/玩法彻底解耦的通用写法)
ui·游戏引擎·godot
特立独行的猫a1 天前
Docker 管理利器:docker-compose-ui 与 Portainer 详解
运维·ui·docker·容器·portainer
web小白成长日记1 天前
Vue3+ElementUI树形菜单:构建层次化用户界面
前端·microsoft·ui·面试·elementui
草莓熊Lotso1 天前
Qt 进阶核心:UI 开发 + 项目解析 + 内存管理实战(从 Hello World 到对象树)
运维·开发语言·c++·人工智能·qt·ui·智能手机
低调小一2 天前
Google A2UI 入门:让 Agent “说 UI”,用声明式 JSON 安全渲染到原生界面
人工智能·安全·ui·json
Swift社区2 天前
Flutter / RN / iOS 的 UI 渲染机制,本质差异在哪里?
flutter·ui·ios
伶俐的猪2 天前
UI_Testing 项目详细文档
开发语言·javascript·ui