使用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自动化测试|XPath元素定位实践
功能测试·测试工具·jmeter·microsoft·ui·postman·harmonyos
川石课堂软件测试3 小时前
UI自动化测试|CSS元素定位实践
css·测试工具·ui·fiddler·单元测试·appium·harmonyos
星辰徐哥13 小时前
Spring Boot 数据导入导出与报表生成
spring boot·后端·ui
for_ever_love__18 小时前
UI学习:UICollectionView瀑布流
学习·ui·ios·objective-c·cocoa
xiaobai17821 小时前
pytest+playwright实现UI自动化(4)-上夹具fixture
ui·自动化·pytest·playwright
为何创造硅基生物1 天前
LVGL 妙用 LV_OBJ_FLAG_FLOATING
ui
ANnianStriver1 天前
PetLumina 04 — 管理后台 UI 全面升级
java·ui·ai编程
ANnianStriver1 天前
PetLumina 05 — App 端 UI 效果应用
java·ui·ai编程
小小龙学IT1 天前
Midscene.js:AI驱动的跨平台UI自动化革命
javascript·人工智能·ui
Wenzar_1 天前
Playwright 实战:高可信 UI 回归验证流水线
java·ui