Vue页面跳转

1:在利用Vue框架Element-ui时,需要有个功能是通过判断method的种类,对点击保存成功以后需要页面跳转



			
				
					保存
					提交
				
			

以下是按钮的保存函数,在通过提交表单内容以后,判断并作出对应的需求
**

页面跳转用到了 this.$router.push({path:’/页面名称’});

**

submitForm(formName, Method) {
				this.$refs[formName].validate((valid) => {
					if(valid) {
						if (Method == '') {
							if (this.data01.Content.DocEntry <= 0) {
								this.submitFun('A')								
							} else{
								this.submitFun('U')							
							}
						} else{
							this.submitFun(Method)
						}
						
						/*this.submitFun(Method)*/
					} else {
						console.log('error submit!!');
						return false;
					}
				});
			},
			submitFun: async function(Method) {
				this.data01.Method = Method;
				if(this.isUpdate && Method !== "T") this.data01.Method = "U";
				this.data01.Content.DocDate = this.timeChange(this.data01.Content.DocDate)
				const res = await this.$http.post(global.MDM + '/MDM0174/MDM017401', this.data01, true)
				if(res.Status === 200) {
					this.$notify.success({
						title: '成功'						
					});
					if (Method == "A") {
					   this.$router.push({path:'/MDM0174'});
					} 
				} else {
					this.$notify.warning({
						title: '读取失败',
						message: res.Status + ':' + res.Message
					})
				}
			},


再加一个在mint-ui中的案例

 
		       
  • 用车申请 {{useCar.DocStatus | useCarDocStatus}}
    出车是由:{{useCar.Comment}}
    出车出发时间:{{useCar.StartDate}}
    出车位置:{{useCar.StartLAddress}}
    出车车牌: {{useCar.CarNo}}
    出车时里程数: {{useCar.StartKm}}

暂无申请记录

这是基于钉钉的mint-ui的微应用,有个按钮会有跳转功能


	whereToGo (DocEntry , DocStatus) {
				if(DocStatus == 'O'){
                	this.$router.push('/CarRecordEndPc_'+DocEntry)
				} else {
                    this.$router.push('/CarRecordDetailPc_'+DocEntry)
				}
				
			},

你可能感兴趣的:(Vue.js)