elementui form必填项显示红色星号但不触发校验

封装的form组件 父组件传rules,必填项显示红色星号但不触发校验

elementui form必填项显示红色星号但不触发校验_第1张图片
dataForm和表单加载item对应项必须相同,我一开始顺序ip和datasource顺序写反了

× dataForm: {
	ip: '',
	datasource: '',
	port: '',
	username: '',
	password: '',
	databaseName: '',
	version: ''
 },
√ dataForm: {
	datasource: '',
	ip: '',
	port: '',
	username: '',
	password: '',
	databaseName: '',
	version: ''
},
dataFormLabel() {
	return [{
			model: 'datasource',
			label: '数据源名称',
			type: 'input'
		},
		{
			model: 'ip',
			label: '数据源ip',
			type: 'input'
		},
		{
			model: 'port',
			label: '端口',
			type: 'input'
		},
		{
			model: 'username',
			label: '用户名',
			type: 'input'
		},
		{
			model: 'password',
			label: '密码',
			type: 'input'
		},
		{
			model: 'databaseName',
			label: '数据库名称',
			type: 'inputButton'
		},
		{
			model: 'version',
			label: '版本号',
			type: 'select',
			options: this.versionOptions
		}
	]
}

你可能感兴趣的:(小问题,elementUI小课堂,vue)