【发布时间】:2020-09-05 16:00:59
【问题描述】:
每当我使用 post 方法时,我都可以立即看到我自己的消息,但是每当有人发布消息时,我直到单击 F5 才看到它。我该如何解决?
methods: {
sendPost() {
axios
.post("https://app3428552893.herokuapp.com/v2/posts", {
name: this.name,
time: this.time,
message: this.newPost
}).then(response => {
this.placeText.unshift(response.data);
})
},
app.post('/v2/posts', (req,res)=> {
const dbCrud = req.body;
Crud.create(dbCrud, (err,data)=> {
if (err) {
res.status(500).send(err)
} else {
res.status(201).send(data)
}
})
【问题讨论】: