This commit is contained in:
hailin 2024-10-25 15:23:06 +08:00
parent b7829fd879
commit 35864176ed
1 changed files with 37 additions and 0 deletions

View File

@ -33,7 +33,23 @@
</form>
<hr>
<!-- 新增导航按钮 -->
<div>
<!-- 跳转到顶部按钮 -->
<button onclick="scrollToTop()">Go to Top</button>
<!-- 跳转到底部按钮 -->
<button onclick="scrollToBottom()">Go to Bottom</button>
<!-- 跳转到指定页面的输入框和按钮 -->
<input type="number" id="pageIndex" placeholder="Enter page number">
<button onclick="goToPage()">Go to Page</button>
</div>
<hr>
<!-- 原有的上一页和下一页按钮 -->
<div>
<button {% if is_first %}disabled{% endif %}>
<a href="{% if not is_first %}{{ url_for('view_customer', index=index-1) }}{% endif %}">Previous</a>
@ -42,5 +58,26 @@
<a href="{% if not is_last %}{{ url_for('view_customer', index=index+1) }}{% endif %}">Next</a>
</button>
</div>
<!-- JavaScript 脚本 -->
<script>
// 跳转到顶部
function scrollToTop() {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
// 跳转到底部
function scrollToBottom() {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
}
// 跳转到指定页面
function goToPage() {
const pageIndex = document.getElementById('pageIndex').value;
if (pageIndex !== '') {
window.location.href = `/customer/${pageIndex}`;
}
}
</script>
</body>
</html>