标签:OLE UNC nbsp ext java switch ack text 跳转
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <a href="#/home" >这里</a> <a href="#/lon">白天</a> <div id="app"></div> <script type="text/javascript"> // console.log(location) //路由的跳转 //onhashchange是window的一个方法 window.onhashchange=function () { console.log(111); console.log(location.hash); //这里可以获取当前的路由信息 switch(location.hash) { case ‘#/home‘: document.getElementById(‘app‘).innerHTML=‘<h2>课程</h2>‘; break; case ‘#/lon‘: document.getElementById(‘app‘).innerHTML = ‘<h2>价钱</h2>‘; break; } } </script> </body> </html>
标签:OLE UNC nbsp ext java switch ack text 跳转
原文地址:https://www.cnblogs.com/whileke/p/11560183.html