html-framework-7 - 由于空引用框架7,模板无法加载
问题描述
我的页面无法加载,因为 logutzaal 的 getElementById 返回 null 但它确实在其他页面上工作,只有这个页面有这个问题(其他页面有相同的导航栏,只有页面内容不同)。
<template>
<div class="page" data-name="light">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner sliding">
<div class="title" id="logoutDiv">
Zaal Toevoegen
<a class="btnLogout" id="logutzaal"
><i class="fas fa-sign-out-alt logoutButton"></i
></a>
<script>
document
.getElementById("logutzaal")
.addEventListener("click", function () {
window.location.href = "../index.html";
});
</script>
</div>
</div>
</div>
<div class="page-content">
<h1>Hello</h1>
</div>
</div>
</template>
解决方案
推荐阅读
- linux - 由于注释中的分号,hosts.allow 中的错误
- excel - 两个数据集之间的 Excel 条件格式
- mysql - MySQL 中是否有一个函数可以在表达到某个值时截断表,比如 100MB?
- python - 如何正确地将我在计算器中按下的数字插入到最后一个索引处的文本小部件中?
- javascript - 在 DevTools 上工作但在 page.evaluate() 内不工作的代码
- javascript - 将数据传递给 Reactstrap 模式
- flutter - 有什么方法可以正确呈现 RichText 以创建黄金测试?
- javascript - 在javascript中将数组转换为json对象内的对象类型
- python - win32com - 使用 python 3.7 从重复的电子邮件中获取最新的 Outlook 电子邮件
- javascript - react js中如何显示函数返回的内容?