<!-- Path to Framework7 iOS CSS theme styles--> <linkrel="stylesheet"href="/bower_components/framework7/dist/css/framework7.ios.min.css"> <!-- Path to Framework7 iOS related color styles --> <linkrel="stylesheet"href="/bower_components/framework7/dist/css/framework7.ios.colors.min.css"> <!-- Path to your custom app styles--> <!-- <link rel="stylesheet" href="path/to/my-app.css"> --> ... <divclass="page-content"> <p>Page content goes here</p> <!-- Link to another page --> <ahref="/about.html">About app</a> </div> ... <!-- Path to Framework7 Library JS--> <scripttype="text/javascript"src="/bower_components/framework7/dist/js/framework7.min.js"></script> <!-- Path to your app js--> <scripttype="text/javascript"src="/js/index.js"></script>
index.js
index.jsは掲載されているコードをそのまま使います。Option 2をどちらも書いているので、aboutページに移動したときに’Here comes About page`のメッセージが2度表示されます。
~/node_apps/docker-framework7/public/js/index.js
// Initialize app and store it to myApp variable for futher access to its methods var myApp = new Framework7();
// We need to use custom DOM library, let's save it to $$ variable: var $$ = Dom7;
// Add view var mainView = myApp.addView('.view-main', { // Because we want to use dynamic navbar, we need to enable it for this view: dynamicNavbar: true });
// Now we need to run the code that will be executed only for About page.
// Option 1. Using page callback for page (for "about" page in this case) (recommended way): myApp.onPageInit('about', function (page) { // Do something here for "about" page
});
// Option 2. Using one 'pageInit' event handler for all pages: $$(document).on('pageInit', function (e) { // Get page data from event data var page = e.detail.page;
if (page.name === 'about') { // Following code will be executed for page with data-page attribute equal to "about" myApp.alert('Here comes About page'); } });
// Option 2. Using live 'pageInit' event handlers for each page $$(document).on('pageInit', '.page[data-page="about"]', function (e) { // Following code will be executed for page with data-page attribute equal to "about" myApp.alert('Here comes About page'); });
実行とiOSから確認
docker-composeからDockerイメージのビルドとコンテナの起動を行います。
$ docker-compose build $ docker-compose up framework7