<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') }) }