Change Boolean onIonViewWillEnter

Can anyone please explain how i can change a boolean in onIonVieWillEnter, thanks :slight_smile:

more detail would be helpful since you change a boolean with a simple assignment statement and I am sure you are looking for something more than that

@aaronksaunders,

thank you for your reply.

In other language like php is easy to change a boolean like $boolean=true and then $boolean=false

but in VUE i don’t find a source to look how i can set a const boolean = true;?

I heared about the lifecycles i think onIonViewWillEnter is one and in this i set a boolean which is true and before that a boolean which is false because if onIonViewWillEnter is true then the IonSlides should be loaded because the IonSlides have a bug with the pager and the settings. Sometimes when i refresh the web or open the app build the slider has no bullets (pager=true).

You can definitely do that in Vue. If using the Options API you would use a data property.

If using the Composition API something like:

setup() {
  const loadSlides = ref(false)

  return {
    loadSlides
  }
}

try it:

import onIonViewWillEnter and onIonViewDidEnter from β€˜@ionic/vue’

    let makeBoolean = ref(false)

    // routing begin loading
    onIonViewWillEnter(() => {

      /** or you're able change it to true like
      makeBoolean.value = true */
      makeBoolean.value = true
    })

    // after routing all animated fired loading
    onIonIonViewDidEnter(() => {
      makeBoolean.value = false;
    })

1 Like