@
bmwh123 抱歉才看懂问题,前面的回答默认以为大家知道实际的机制了呢。。。
实际上单个大页面分为主页面和子页面,主页面里大概是这样子的:
<div class="main">
<div id="nav"></div>
<div id="dashboard.html"></div>
<div id="charts-chartjs.html"></div>
<div id="forms-basic-inputs.html"></div>
<div id="forms-layouts.html"></div>
<div id="icons-feather.html"></div>
<div id="maps-google.html"></div>
<div id="pages-blank.html"></div>
<div id="pages-invoice.html"></div>
<div id="pages-profile.html"></div>
<div id="pages-settings.html"></div>
<div id="pages-sign-in.html"></div>
<div id="pages-sign-up.html"></div>
<div id="tables-bootstrap.html"></div>
<div id="ui-alerts.html"></div>
<div id="ui-buttons.html"></div>
<div id="ui-cards.html"></div>
<div id="ui-general.html"></div>
<div id="ui-grid.html"></div>
<div id="ui-modals.html"></div>
<div id="ui-typography.html"></div>
<div id="footer"></div>
</div>
每个子 div 的 id 对应一个子页面,然后才是上面 lazy 相关的回答,如果 lazy 默认是不加载的、而等用户首次点击触发 $pm.select(...) 或者代码 $pm.select(...) 时才去加载的,并不是进到主页默认就把所有加载进来