小编Bas*_*mal的帖子

Vuejs 和页面刷新 <router-link> 单击

我想在单击路由器链接后刷新页面。我如何在 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)

vue.js vuejs2

2
推荐指数
1
解决办法
5305
查看次数

标签 统计

vue.js ×1

vuejs2 ×1