前言

elementUI的报错汇总

错误

please transfer a valid prop path to form item!

vue.esm.js?c5de:628 [Vue warn]: Error in mounted hook: "Error: please transfer a valid prop path to form item!"

found in

---> <ElFormItem> at packages/form/src/form-item.vue
<ElForm> at packages/form/src/form.vue
<StaffInfo> at src/pages/system/staffManage/components/staffInfo.vue
<ElDialog> at packages/dialog/src/component.vue
<DepartmentManage> at src/pages/system/staffManage/departmentManage.vue
<Main> at src/pages/system/main.vue
<Main> at src/pages/main.vue
<App> at src/App.vue
<Root>
warn @ vue.esm.js?c5de:628
logError @ vue.esm.js?c5de:1893
globalHandleError @ vue.esm.js?c5de:1888
handleError @ vue.esm.js?c5de:1848
invokeWithErrorHandling @ vue.esm.js?c5de:1871
callHook @ vue.esm.js?c5de:4222
insert @ vue.esm.js?c5de:3148
invokeInsertHook @ vue.esm.js?c5de:6351
patch @ vue.esm.js?c5de:6570
Vue._update @ vue.esm.js?c5de:3951
updateComponent @ vue.esm.js?c5de:4069
get @ vue.esm.js?c5de:4482
run @ vue.esm.js?c5de:4557
flushSchedulerQueue @ vue.esm.js?c5de:4313
(anonymous) @ vue.esm.js?c5de:1989
flushCallbacks @ vue.esm.js?c5de:1915
Promise.then (async)
timerFunc @ vue.esm.js?c5de:1942
nextTick @ vue.esm.js?c5de:1999
queueWatcher @ vue.esm.js?c5de:4405
update @ vue.esm.js?c5de:4547
notify @ vue.esm.js?c5de:739
mutator @ vue.esm.js?c5de:891
addCard @ staffInfo.vue?2ad2:215
invokeWithErrorHandling @ vue.esm.js?c5de:1863
invoker @ vue.esm.js?c5de:2188
invokeWithErrorHandling @ vue.esm.js?c5de:1863
Vue.$emit @ vue.esm.js?c5de:3891
handleClick @ element-ui.common.js?1a2a:9169
invokeWithErrorHandling @ vue.esm.js?c5de:1863
invoker @ vue.esm.js?c5de:2188
original._wrapper @ vue.esm.js?c5de:7559
vue.esm.js?c5de:1897 Error: please transfer a valid prop path to form item!
at getPropByPath (util.js?6b81:73)
at VueComponent.fieldValue (element-ui.common.js?1a2a:23052)
at Watcher.get (vue.esm.js?c5de:4482)
at Watcher.evaluate (vue.esm.js?c5de:4587)
at VueComponent.computedGetter [as fieldValue] (vue.esm.js?c5de:4839)
at VueComponent.mounted (element-ui.common.js?1a2a:23196)
at invokeWithErrorHandling (vue.esm.js?c5de:1863)
at callHook (vue.esm.js?c5de:4222)
at Object.insert (vue.esm.js?c5de:3148)
at invokeInsertHook (vue.esm.js?c5de:6351)

动态添加删除表单的时候报错

https://element.eleme.io/#/zh-CN/component/form

源码

<el-form :model="dynamicValidateForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
<el-form-item
prop="email"
label="邮箱"
:rules="[
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
]"
>
<el-input v-model="dynamicValidateForm.email"></el-input>
</el-form-item>
<el-form-item
v-for="(domain, index) in dynamicValidateForm.domains"
:label="'域名' +(++index)"
:key="domain.key"
:prop="'domains.' + index + '.value'"
:rules="{
required: true, message: '域名不能为空', trigger: 'blur'
}"
>
<el-input v-model="domain.value"></el-input><el-button @click.prevent="removeDomain(domain)">删除</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('dynamicValidateForm')">提交</el-button>
<el-button @click="addDomain">新增域名</el-button>
<el-button @click="resetForm('dynamicValidateForm')">重置</el-button>
</el-form-item>
</el-form>
<script>
export default {
data() {
return {
dynamicValidateForm: {
domains: [{
value: ''
}],
email: ''
}
};
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
removeDomain(item) {
var index = this.dynamicValidateForm.domains.indexOf(item)
if (index !== -1) {
this.dynamicValidateForm.domains.splice(index, 1)
}
},
addDomain() {
this.dynamicValidateForm.domains.push({
value: '',
key: Date.now()
});
}
}
}
</script>

修复

<el-form-item
v-for="(domain, index) in dynamicValidateForm.domains"
:label="'域名' + index" //修改
:key="domain.key"
:prop="'domains.' + index + '.value'"
:rules="{
required: true, message: '域名不能为空', trigger: 'blur'
}"
>
<el-input v-model="domain.value"></el-input><el-button @click.prevent="removeDomain(domain)">删除</el-button>
</el-form-item>

原因

index进行++操作后,下面的index都是从1开始的,所以肯定找不到了

ElementUI——报错汇总的更多相关文章

  1. Ambari集成Kerberos报错汇总

    Ambari集成Kerberos报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.查看报错的配置信息步骤 1>.点击Test Kerberos Client,查看相 ...

  2. Python_环境部署及报错汇总(0)

    一.安装Anaconda Anaconda是一个开源的包.环境管理器,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换. Anaconda包括Conda.Python以及 ...

  3. selenium报错汇总

    selenium报错汇总 报错:[error] Could not connect to Selenium Server. Have you started the Selenium Server y ...

  4. Ubuntu操作系统编译安装zabbix报错汇总

    Ubuntu操作系统编译安装zabbix报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.报错提示:"configure: error: MySQL libra ...

  5. 按需引入element-ui报错

    按需引入element-ui报错 项目用的脚手架是 vue-cli 3 按照官方文档按需引入组件: https://element.eleme.cn/#/zh-CN/component/quickst ...

  6. TypeError: value.getTime is not a function (elementUI报错转载 )

    "TypeError: value.getTime is not a function" 2018年07月02日 16:41:24 leeleejoker 阅读数:2091 标签: ...

  7. vue2.0+按需引入element-ui报错

    项目使用vue脚手架自动生成的,vue版本为^2.5.16.项目中需要按需使用element-ui,根据element-ui的官方文档,一开始在babel.config.js文件中修改配置 modul ...

  8. vue-cli3 按需引入 element-ui 报错

    报错信息: Cannot find module 'babel-preset-es2015' from .... 解决办法: 安装最新的 Babel 编译插件:@babel/preset-env 修改 ...

  9. iOS 报错汇总

    1. Unknown type name 'class'; did you mean 'Class' 问题解决方法 objectice-c 工程中的类(比如 类 A)使用 C++ 文件时  A.m 文 ...

随机推荐

  1. python入门之与用户交互

    目录 一.程序与用户交互 1.1 什么是与用户交互 1.2 为什么要与用户交互 1.3 如何与用户交互 1.4 python2和python3中input的区别 1.4.1 python3中的inpu ...

  2. Spring Initializr生成的demo测试404错误

    体验Spring Initializr生成的spring boot工程,启动成功, 目录结构如下: 添加了一个简单的controller后,启动成功但访问报404错误: 原因: springboot默 ...

  3. 18 SpringMVC 文件上传和异常处理

    1.文件上传的必要前提 (1)form 表单的 enctype 取值必须是:multipart/form-data(默认值是:application/x-www-form-urlencoded) en ...

  4. [转帖]nginx学习,看这一篇就够了:下载、安装。使用:正向代理、反向代理、负载均衡。常用命令和配置文件

    nginx学习,看这一篇就够了:下载.安装.使用:正向代理.反向代理.负载均衡.常用命令和配置文件 2019-10-09 15:53:47 冯insist 阅读数 7285 文章标签: nginx学习 ...

  5. 山峰和山谷 Ridges and Valleys

    题目描述 思路 一开始看这道题目,也不是很会,谁会把统计之类的问题和bfs联系在一起,没有开始的状态,没有结束的状态,题目中连一个最短之类的词也没有出现. 然后统计嘛,题目中说了方格高度都相同,就把周 ...

  6. matlab界面UI设计资料

    一个实现图像灰度处理并归类于某已知相似图片的程序 软件:matlab2017a 算法:HU检索图像算法.Zernike算法 资料: ①: matlab遍历文件夹下所有图片和遍历所有子文件夹下图片 - ...

  7. Django开发之登陆和登出

    使用django自带的验证模块 1.首先使用python manage.py startapp models为当前项目添加一个应用. 2.在setting.py中INSTALLED_APPS后面添加' ...

  8. Java程序员必了解的JVM原理以及虚拟机的运行过程

    JVM概念 虚拟机:指以软件的方式模拟具有完整硬件,VM概念 虚拟机:指以软件的方式模拟具有完整硬件系统功能.运行在一个完全隔离环境中的完整计算机系统 ,是物理机的软件实现.常用的虚拟机有VMWare ...

  9. (四) Docker 使用Let's Encrypt 部署 HTTPS

    参考并感谢 周花卷 https://www.jianshu.com/p/5afc6bbeb28c 下载letsencrypt镜像(不带tag标签则表示下载latest版本) docker pull q ...

  10. mybatis使用foreach处理List中的Map mybatis-----传入传出多个参数,都是map或list,批量更新

    https://nannan408.iteye.com/blog/2170470 https://blog.csdn.net/xingzhishen/article/details/86424395 ...