我们在Framework7的文档views页面可以看到。
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">
如果我按照文档的建议进行操作,例如,在框架7包随附的应用程序中,单 View 应用程序,位于/dist/index.html 下,如果我执行以下操作:
<div class="view view-main" data-url='about.html'>
但是当我打开 index.html 时,主视图并没有指向 about.html。
为什么会这样?
最佳答案
它不是那样工作的。我认为您想在主视图中默认加载 about.html 。你可以这样做:
<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>
关于javascript - Framework7 : Default url to a different view is not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34420228/