<!--引入resource-->
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
methods: {
handleSubmit(name) {
var userno=this.formInline.user;
var password=this.formInline.password;
this.$refs[name].validate((valid) => {
if (valid) {
this.$http.post('路径',
JSON.stringify({userno:userno,password:password}),
//Post请求重要
{headers:{'Content-Type': 'application/json;charset=UTF-8'
}})
.then(function(res){
console.log("resd="+JSON.stringify(res))
});
this.$Message.success('提交成功!');
} else {
this.$Message.error('表单验证失败!');
}
})
}
}