Make router load scripts in page

Hi noticed that, when loading a page with url, f7 will only load the div with .page class in the page, but throw away the scripts and css links. So I have to write the js code in the index.html or in a seperate file and then includ it in the index.html. Thus loading index.html will cost a lot of time. It will load all the js and css files in all pages. Is there any way to solve this?
Finaly, I solve this, by changing the src files of f7 to load scripts and css links of each page into index.html when loading , and remoe them when unloading the page. Now it seems work finaly, and I can write single page application like normal web application. Each page has its own sets of html, js ,css. It is clear and fast to load.
The question is that, is there any other easier way to archive this?

It is a browser security policy, it won’t load/parse scripts and style tags added by Ajax. You can use router component that can handle it better http://framework7.io/docs/router-component.html

thanks, single file component looks like vue, it is great. can i include a js file in that file?(i don’t wanna load all js files at a time)

hi, can you tell me the detail? how to use js in html page?