How to use page init?


hello,code like this,dont work,why?


Место где app.on - если у вас Cordova, то события с большой вероятностью вы не поймаете, т.е. init будет после device ready.


hi,can you reply english?


try assign url prop to .main-view
<div class="view view-main" url="/"></div>
and also make sure u install routes as well


thanks, but the same


you have to declare routes at init app
> var app = new Framework7({

  // App root element
  root: '#app',
  // App Name
  name: 'My App',
  // App id
  id: 'com.myapp.test',
  // Enable swipe panel
  panel: {
    swipe: 'left',
  // you have to declare routes at init app
> routes: [
      path: '/about/',
      url: 'about.html',
  // ... other parameters


Here on forum, there are lot of similar topics. It happens because you add your page:init handlers AFTER home page was initialized. Add them before new Framework7 or add it to app parameters events, on: {pageInit() {....}}


thanks very much! it is work


Не “url”, а data-url.

И так нельзя писать. Или добавить view-init или убрать data-url="/", а добавить url при создании view с помощью JS.
Здесь " In this case we may pass them in data- attributes.