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

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

相关推荐
修炼前端秘籍的小帅4 天前
Stitch——Google热门的免费AI UI设计工具
前端·人工智能·ui
王码码20354 天前
Flutter for OpenHarmony:socket_io_client 实时通信的事实标准(Node.js 后端的最佳拍档) 深度解析与鸿蒙适配指南
android·flutter·ui·华为·node.js·harmonyos
2501_921930835 天前
Flutter for OpenHarmony:第三方库实战 chewie 视频播放器UI组件详解
flutter·ui
梵得儿SHI5 天前
Vue3 生态工具实战宝典:UI 组件库 + 表单验证全解析(Element Plus/Ant Design Vue/VeeValidate)
前端·vue.js·ui·elementplus·vue性能优化·antdesignvue·表单验证方案
Unity游戏资源学习屋5 天前
【Unity UI资源包】GUI Pro - Casual Game 专为休闲手游打造的专业级UI资源包
ui·unity
麻瓜呀5 天前
vue2 Element-ui框架相关常见问题-表单组件重置显示异常
运维·服务器·ui
少云清6 天前
【UI自动化测试】4_PO模式 _PO模式封装
ui·po模式
菜鸟小芯6 天前
【GLM-5 陪练式创意 UI 实战】第二篇:创意魔法盒 —— 从 “开心” 到 “科技感”,AI 驱动的 UI 风格迭代
科技·ui