view.jade
doctype html
html
meta(charset='utf-8')
style
include view.css
script
include ../fetch/fetch.js
body
header
section
nav
main(id='view')
家玉
div(id='main_image')
input(type='image' class='leftbtn' src='/leftbtn.png')
input(type='image' class='rightbtn' src='/rightbtn.png')
p(class='main_p') sth
div(class='wrap_item')
fetch.js
fetch('home.jade').then((res)=>{
res.text().then((text)=>{
document.querySelector('#view').innerHTML = text;
});
});
Jade代码不能被浏览器理解,这就是为什么它被转换为HTML。你应该取回home.html,因为那才是浏览器真正能理解的代码。