2021年1月26日星期二

Ionic 5 React page crashes on device when window location href has variables

I have a ionic-refresher component, and in it i am trying to use window.location.href, and it works when i do not have any variables in the value, like this

window.location.href = '/tab1';  

but it does not work when i do have variables, like this

window.location.href = '/listing/' + id  

Any ideas on how to solve this?

What i have tried is window.open(), window.replace(), history.go(0), history.push().

Full code here

<IonRefresher slot='fixed' onIonRefresh={doRefresh}       pullFactor={0.5} pullMin={100} pullMax={200}>      <IonRefresherContent></IonRefresherContent>  </IonRefresher>    function doRefresh(event: CustomEvent<RefresherEventDetail>) {                    // window.open("/listings/" + id.id, "_self")                    // history.push("/listings/" + id.id)              // history.go(0)          }  
https://stackoverflow.com/questions/65902138/ionic-5-react-page-crashes-on-device-when-window-location-href-has-variables January 26, 2021 at 09:20PM

没有评论:

发表评论