Javascript 在本地主机上工作,但它在部署 github 页面或 vercel 时停止
Javascript works on localhost, but it stops on deploy github pages or vercel
有人能告诉我为什么 javascript 在本地主机上工作,但是当使用 github 页面或 vercel 时,javascript 停止了吗?
代码 github:https://github.com/Marincor/Bx-Bank
部署github页面:https://marincor.github.io/Bx-Bank/
在 Vercel 上部署:https://bx-bank.vercel.app/
当我转到 index.html 和 cadastro.html 页面的开发工具源代码时,它们没有我链接的 JS 文件夹。
print of devTools chrome sourcers tab
print of github JS folder
print of the script src inside the html file
我不知道该怎么办,有什么提示吗?
出于某种原因,home.html 对 javascript 文件起作用,只是 index.html 而 cadastro.html 不起作用。
像处理 css 链接一样,使用前面的 ./
格式化脚本文件的路径:
<script type="module" src="./Assets/JS/Index.js"></script>
编辑:注意大小写:
<script type="module" src="./Assets/JS/index.js"></script>
有人能告诉我为什么 javascript 在本地主机上工作,但是当使用 github 页面或 vercel 时,javascript 停止了吗?
代码 github:https://github.com/Marincor/Bx-Bank
部署github页面:https://marincor.github.io/Bx-Bank/
在 Vercel 上部署:https://bx-bank.vercel.app/
当我转到 index.html 和 cadastro.html 页面的开发工具源代码时,它们没有我链接的 JS 文件夹。
print of devTools chrome sourcers tab
print of github JS folder
print of the script src inside the html file
我不知道该怎么办,有什么提示吗?
出于某种原因,home.html 对 javascript 文件起作用,只是 index.html 而 cadastro.html 不起作用。
像处理 css 链接一样,使用前面的 ./
格式化脚本文件的路径:
<script type="module" src="./Assets/JS/Index.js"></script>
编辑:注意大小写:
<script type="module" src="./Assets/JS/index.js"></script>