我想在单击路由器链接后刷新页面。我如何在 Laravel 中使用 Vue JS 做到这一点?但我不想使用onclick="window.location.reload();"
我的代码是这样的——
app.js 中的代码
{
path: '/publisher',
component: require('./components/Publishers.vue').default,
}
Run Code Online (Sandbox Code Playgroud)
Master.blade.php 中的代码
<li> <router-link to="/publisher" class="nav-link" >????????</router-link></li>
Run Code Online (Sandbox Code Playgroud)
Publishers.vue 中的代码
export default {
components: {
},
data() {
return {
Publishers: {},
};
},
computed: {},
methods: {
loadPublishers() {
this.$Progress.start();
axios.get("api/publisher").then(({ data }) => (this.Publishers = data));
},
},
created() {
this.loadPublishers();
// load the page after 3 secound
Fire.$on("refreshPage", () => {
this.loadPublishers();
});
}
};
Run Code Online (Sandbox Code Playgroud)