mintUI之MessageBox表单验证


<div class="mobileTrainActivityDetailButton_css">
	<mt-button v-if="path=='/mobileMyTrains'?true:false" @click.native="leave" size="large"> 请假 </mt-button>
</div>

//方法体里面
leave() {
   MessageBox.prompt('请假理由', { inputValidator: (val) => { if (val === null) {    return true;//初始化的值为null,不做处理的话,刚打开MessageBox就会校验出错,影响用户体验 } return !(val.length < 100)   }, inputErrorMessage: '不能小于100字' }).then((val) => { this.loading = true; var leaveForm = { trainId: this.trainInfo.trainId, leaveFlow: this.trainInfo.leaveFlow, leaveReason: val, }; this.postRequest("/tmsproxy/trainLeave", leaveForm).then(resp => { this.loading = false; if(resp.data.status == "success") { MessageBox.alert(resp.data.msg, ""); } }) }, () => { console.info('cancel') }) }

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM