uni-app 在 hbuilderX 3.2.3.20210825 版本中修改 index.html 无效
uni-app 在 hbuilderX 3.2.3.20210825 版本中修改 index.html 无效
操作步骤:
- https://www.npmjs.com/package/@easydarwin/easyplayer 中Vue 集成调用
预期结果:
- 正常使用
实际结果:
- index.html修改无效
bug描述:
hbuilderX 3.2.3.20210825 版本创建uniapp
- index.html 修改无效
- 准备使用easyVideo.js 引入无效
- 修改title也不生效
- 使用vue就可以正常使用
3.2.3之前版本 类似vue public index.html文件添加js文件
uniapp应该怎么操作
更多关于uni-app 在 hbuilderX 3.2.3.20210825 版本中修改 index.html 无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复
更多关于uni-app 在 hbuilderX 3.2.3.20210825 版本中修改 index.html 无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html
在 uni-app 项目中,index.html 文件默认由构建工具自动生成,直接修改项目根目录下的 index.html 通常不会生效。这是因为 uni-app 在构建过程中会基于模板重新生成该文件。
针对你的需求,可以尝试以下方法:
-
使用
manifest.json配置:- 在
manifest.json的"h5"节点下,通过"template"字段指定自定义的 HTML 模板文件路径。 - 例如:
"h5": { "template": "public/index.html" } - 然后在
public/index.html(或其他自定义路径)中修改标题或添加外部 JS 文件。
- 在
-
通过
main.js动态添加脚本:- 在
main.js中使用 DOM 操作动态插入<script>标签,适用于需要引入第三方库(如 easyVideo.js)的场景。 - 示例:
const script = document.createElement('script'); script.src = 'https://example.com/easyvideo.js'; document.head.appendChild(script);
- 在

