We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第288天 用js封装一个前端分页的库,说说你的思路
我也要出题
The text was updated successfully, but these errors were encountered:
使用hash路由实现分页 好处就是不用刷新页面,来刷新内容。
<body> <a href="#pageA">pageA</a> <a href="#pageB">pageB</a> <div class="a"> hello world </div> <div class="b"> 你好 </div> <script> const pageA = document.querySelector('.a') const pageB = document.querySelector('.b') pageA.setAttribute('style', 'display: none') pageB.setAttribute('style', 'display: none') window.addEventListener('load', () => { const hash = window.location.hash.slice(1) if (!hash) { window.location.hash = '/' } }) window.addEventListener('hashchange', () => { const hash = window.location.hash.slice(1) switch (hash) { case 'pageA': pageA.setAttribute('style', 'display: block') pageB.setAttribute('style', 'display: none') break case 'pageB': pageA.setAttribute('style', 'display: none') pageB.setAttribute('style', 'display: block') break default: pageA.setAttribute('style', 'display: none') pageB.setAttribute('style', 'display: block') break } }) </script>
Sorry, something went wrong.
const pagination = (function(param) { function prev() {} function next() {} function first() {} function last() {} function jump() {} return { prev, next, first, last, jump } }(data)) pagination.prev() pagination.next()
No branches or pull requests
第288天 用js封装一个前端分页的库,说说你的思路
我也要出题
The text was updated successfully, but these errors were encountered: