Skip to content

Commit c8250a0

Browse files
committed
📝 前端程序没问题调整后端接口问题
1 parent 1adc5b2 commit c8250a0

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/Message.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,21 @@
5252
5353
this.$refs[formName].validate((valid) => {
5454
if (valid){
55-
console.log(this.form.content+','+this.form.name+","+Date.parse(new Date())/1000);
55+
// console.log(this.form.content+','+this.form.name+","+Date.parse(new Date())/1000);}
56+
this.$http({
57+
method: 'post',
58+
url: 'http://www.bai3.xyz/comment/add',
59+
data:{
60+
"name": this.form.name,
61+
"content": this.form.content
62+
}
63+
})
64+
.then(function (response) {
65+
console.log(response);
66+
})
67+
.catch(function (error) {
68+
console.log(error);
69+
});
5670
let _self = this;
5771
this.$message({
5872
message: '留言成功,请去留言列表查看',

src/components/MessageList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
alert('6666')
4242
}
4343
},
44-
beforeCreate: function () {
44+
beforeMount: function () {
4545
this.$http("http://www.bai3.xyz/comment/getlist")
4646
.then(response => {console.log(response);this.comments = response.data.reverse()})
4747
},

0 commit comments

Comments
 (0)