For example, I want to let the page refresh, but the page is blank, and the data must be refreshed by hand.
asyncData ({ params, error }) {
return axios.get('http://localhost:3333/api/newslist')
.then((res) => {
return { datas: res.data }
}).catch (err => {
console.log('报错了啊')
})
},
methods: {
deletFn(id) {
axios.get('http://localhost:3333/api/newsdelet/' + id)
.then((res) => {
alert('The article is deleted successfully!')
location.reload()
}).catch (err => {
console.log('报错了啊', err)
})
}
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2630">#c2630</a>)</em></sub></div>