Vue3 刷新当前页面 - 使用 location.reload() 方法
在 Vue3 中,可以使用 'location.reload()' 方法来刷新当前页。可以在需要刷新的地方调用该方法,例如在按钮的点击事件中调用:
<button @click="refreshPage">刷新当前页</button>
// 在 methods 中定义刷新当前页的方法
methods: {
refreshPage() {
location.reload();
}
}
这样当按钮被点击时,就会刷新当前页。
原文地址: https://www.cveoy.top/t/topic/qakr 著作权归作者所有。请勿转载和采集!