最近在做vue+element-ui的后台管理页面,其中用到了datetimepicker来选择日期时间,但是在将数据传回后台的过程中遇到了一些令人头疼的问题,在此记录一下解决方案,以免日后再次遇到。
前端页面
前端代码
submitform(formname) {
this.$refs[formname].validate((valid) => {
let url = 'http://localhost:8088/pethospital/order-record'
let data = qs.stringify({
title: this.orderform.title,
hospitalid: this.orderform.hospitalid,
orderdate: this.orderform.orderdate,
ordertype: this.orderform.ordertype,
petvariety: this.orderform.petvariety,
mobilephone: this.orderform.mobilephone,
supplement: this.orderform.supplement
})
if (valid) {
axios.post(url, data)
.then(response => {
}).catch(error => {
this.$message({
<