Commit 385b1e54 authored by yeahzzzz's avatar yeahzzzz

Delete spa_index.html

parent be27fe6a
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>test</title>
<script type="text/javascript" src='js/jquery-3.3.1.js'></script>
<link rel="stylesheet" href="css\spa_index.css">
</head>
<script type="text/javascript">
let router=[
{
name:"index",
path:"/index",
title:"首页",
isActive:"false",
},
{
name:"news",
path:"/news",
title:"新闻",
isActive:"true",
},
{
name:"about",
path:"/about",
title:"介绍",
isActive:"false",
},
]
function createHtmlPages() {
changePage('index')
}
function changePage(pageName) {
let index= -1
let indexActive=-1
for (var i = 0; i < router.length; i++) {
if (router[i].name==pageName) {
index=i;
}
if (router[i].isActive) {
indexActive=i;
}
}
if (index!=-1 && index!=indexActive) {
router[index].isActive=true;
router[indexActive].isActive=false
console.log("changed to"+ pageName);
}else {
console.log("page not found");
}
refreshHtml()
}
function refreshHtml() {
let htmlContent=' ';
for (let i = 0; i < router.length; i++) {
let addClass=' '
if (router[i].isActive) {
addClass=' '
} else {
addClass='hide';
}
htmlContent= htmlContent+ "<div class='page page-bgcolor-blue "+addClass+"' routeName='page-"+router[i].name+"'>"+router[i].title+"</div>"
}
console.log(htmlContent)
$("#layout-1").html(htmlContent)
}
</script>
<body>
<div id="layout-1 ">
</div>
<!-- <div class="page page-bgcolor-blue" id="page-1">
<div>
<span onclick='changePage("page-1")'>首页</span>
<span onclick='changePage("page-2")'>新闻</span>
<span onclick='changePage("page-3")'>介绍</span>
</div>
<h1>首页</h1>
</div>
<div class="page page-bgcolor-blue" id="page-2">
<div>
<span onclick='changePage("page-1")'>首页</span>
<span onclick='changePage("page-2")'>新闻</span>
<span onclick='changePage("page-3")'>介绍</span>
</div>
<h1>新闻</h1>
</div>
<div class="page page-bgcolor-blue" id="page-3">
<div>
<span onclick='changePage("page-1")'>首页</span>
<span onclick='changePage("page-2")'>新闻</span>
<span onclick='changePage("page-3")'>介绍</span>
</div>
<h1>介绍</h1>
</div> -->
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment