javascript Shopware 6:使用管理功能保存后重新加载路线

ff29svar  于 2022-12-28  发布在  Java
关注(0)|答案(1)|浏览(103)

我想在保存实体车辆后重新加载路线“sw.vehicles.list”,该怎么做?我用过window.reload(),但是不起作用!你能帮帮我吗?

methods: {
        async onStartProcess(e) {

            this.isLoading = true;
 
            this.sw_vehicles = this.repository.create(Shopware.Context.api);
                            
            if(data[i]['name']) this.sw_vehicles.vehicleName= data[i]['name'];
            if(data[i]['type']) this.sw_vehicles.vehicleType = data[i]['type'];
        
            this.repository.save(this.sw_vehicles, Shopware.Context.api).then(() => {
                        this.isLoading = false;
                        this.processSuccess = true;
                        this.$router.push({ name: 'sw.vehicles.list' });
                                
                        // reload the page "sw.vehicles.list"
               }).catch((exception) => {
                        this.isLoading = false;
                        this.createNotificationError({ 
                            title: this.$t('sw-vehicles.import.errorTitle'),
                            message: exception
                        });
              });
             }                    
            }                  
          } 
        },

        saveFinish(e) {
            this.processSuccess = false;
        },
}
k0pti3hp

k0pti3hp1#

理想情况下,您不希望在使用React式框架时重新加载整个页面,但这仍然是一个诀窍:

window.location.reload(true)

boolean参数仅用于Firefox中断该高速缓存。

相关问题