dspjm
dspjm

Reputation: 5850

Framework7: Default url to a different view is not working

As we can see in the views page of documents in Framework7.

Default View URL

If you think that for some reason Framework7 detects wrong default View URL (which is used for navigation history), or if you want to have different default View URL, you can specify it using data-url attribute on View element or using url parameter when you initialze View:

<div class="view" data-url="index2.html">

If I do as the doc suggests, for example, in the app which accompany the framework7 package, single view app, laying under /dist/index.html, if I do something like:

<div class="view view-main" data-url='about.html'>

But when i open index.html, the main view is not directing to about.html.

Why is this happening?

Upvotes: 0

Views: 1086

Answers (1)

Tim V
Tim V

Reputation: 500

It does not work like that. I think you want to load the about.html as default in the main view. You can do this something like this:

<html>
<head>
    ...    
</head>
<body>
    ....
    <div class="views">
        <div class="view view-main"></div>
    </div>
    ...
    <script type="text/javascript" src="js/framework7.min.js"></script> 
    <script type="text/javascript" src="js/my-app.js"></script>    
    ...

    <script>
        mainView.router.loadPage('about.html');
    </script>   

</body>
</html>

Upvotes: 1

Related Questions