pageInit not triggered in v5.1.0

Hi,

I have shared my app init and then page init code with version 4 it was working like charm but i don’t understand why pageInit is not getting fired in version 5.1.0 any suggestions what am I doing wrong over here?

My both code is in same file app.js

// Init App
var app = new Framework7({
  id: "com.xyz.xyz",
  root: "#app",
  name: "xyz",
  theme: theme,
  dialog: {
    title: "xyz"
  },
  routes: routes,
  popup: {
    closeOnEscape: true
  },
  sheet: {
    closeOnEscape: true
  },
  popover: {
    closeOnEscape: true
  },
  actions: {
    closeOnEscape: true
  }
});



app.on("pageInit", function(page) {
  console.log(page);
  if (page.name === "home") {
    console.log("home init");
    var homeSwiper = app.swiper.create(".primary-swiper", {
      speed: 400,
      autoplay: {
        delay: 3000,
        disableOnInteraction: false
      },
      on: {
        init: function() {
          console.log("swiper initialized");
        }
      }
    });
    homeSwiper.init();
  }
});

try this method inside your page

<script>
    import $$ from 'dom7';
    export default {
        on: {
            pageInit: function () {
                const self = this;
                var app = self.$app;
                // In page events:
                $$(document).on('page:init', function (e) {
                    // Page Data contains all required information about loaded and initialized page
                    var page = e.detail;
                    console.log(page);
                })
            }
        },
    };
</script>

Hi @Hadley,

thank you for your response but I am here trying to get it work for index page and in the same manner as i have put in code earlier. Is there any way to get it work in that manner because I have other code which need to be managed inside that section?

Please, do a forum search on how to listen for page events on initial pages, there is a lot of similar topics here

Hi @nolimits4web and @Hadley,

Thank you for your responses, I have got the solution for my issue.

I initialized the app with init: false and after putting my page init code i manually initialized it with app.init();