ElemeFE / ElemeFE/mint-ui

message-box 在有input输入时,如何校验显示错误信息呢?

Open
#426 5 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Vue
Stars
16.4k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

### Mint UI 2.0.4

### Device model
chorme
### 遇到的问题?
当我使用message-box时,当前需要的是弹框输入功能,如下:
![alert](https://cloud.githubusercontent.com/assets/22952321/20055603/da97190c-a51c-11e6-935b-7b3ea5ad6c05.gif)
`MessageBox.prompt('请输入姓名').then(({ value, action }) => {
...
});`
当我使用上面写法时,我是可以获取value,action的值
`MessageBox({
title: '请输入充值卡密码',
message: ' ',
showCancelButton: true,
inputValue: '',
showInput: true,
inputType: 'tel',
inputErrorMessage: '充值卡密码输入错误'
}).then(({ value, action }) => {
console.log(value, action)
})`
当我使用这种写法时,value和action的值无法获取,但是如果.then(action => {}) 是可以获取到操作信息的,
还有一个问题就是,我如果相对输入的文本进行校验并且显示错误信息,我在源码中看到inputErrorMessage这个参数以及validate() 这个方法,如何在点击`确定`按钮后去校验输入数据如果失败弹框不关闭呢?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.