使用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了!

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

相关推荐
御承扬10 小时前
鸿蒙NDK UI之文本自定义样式
ui·华为·harmonyos·鸿蒙ndk ui
一起养小猫12 小时前
Flutter for OpenHarmony 实战_魔方应用UI设计与交互优化
flutter·ui·交互·harmonyos
会一点设计21 小时前
6个优质春节海报模板网站推荐!轻松设计马年祝福海报
ui·ux
hudawei9961 天前
TweenAnimationBuilder和AnimatedBuilder两种动画的比较
flutter·ui·动画·tweenanimation·animatedbuilder
依米阳光081 天前
Playwright MCP AI实现自动化UI测试
ui·自动化·playwright·mcp
芷栀夏2 天前
CANN 仓库实战:用 DrissionPage 构建高效、稳定的 UI 自动化测试框架
ui·aigc·transformer·cann
微祎_2 天前
构建一个 Flutter 点击速度测试器:深入解析实时交互、性能度量与响应式 UI 设计
flutter·ui·交互
AAA阿giao2 天前
从零拆解一个 React + TypeScript 的 TodoList:模块化、数据流与工程实践
前端·react.js·ui·typescript·前端框架
晚霞的不甘2 天前
Flutter for OpenHarmony 构建简洁高效的待办事项应用 实战解析
flutter·ui·前端框架·交互·鸿蒙
百思可瑞教育2 天前
构建自己的Vue UI组件库:从设计到发布
前端·javascript·vue.js·ui·百思可瑞教育·北京百思教育