1***@qq.com
1***@qq.com
  • 发布:2024-11-05 10:59
  • 更新:2024-11-05 11:07
  • 阅读:63

移动端app项目动态插入script,打包后无效怎么办

分类:uni-app
const script = document.createElement('script')  
script.src = '本地js路径.js'  
document.head.appendChild(script)

app的vue页面通过这种方式引用本地js插件,用H5浏览、或者真机调试时运行正常,但是打包成安卓包,安装到手机上后,引入的js无效,导致页面无法展示,有什么其他方法么?

用import 引入的话插件会报错:
Module parse failed:Unexpected token(64 : 194745)
File was processed with these loaders:
./node_modules/babel-loader/lib/index.js
./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js
You may need an additional loader to handle the result of these loaders.
| * licensed under the bsd-3-clause license

2024-11-05 10:59 负责人:无 分享
已邀请:
l***@3975.com

l***@3975.com

app端不支持使用document操作节点

要回复问题请先登录注册