独孤靖云
独孤靖云
  • 发布:2023-12-07 09:45
  • 更新:2023-12-07 11:58
  • 阅读:285

uniapp APP端怎么加载远程js文件

分类:uni-app

我想要在APP中加载一个远程js文件。比如https://www.example.com/demo.js。这个文件里面有APP中要用到的变量和方法,改变量的时候直接改js文件就行,就不用再改APP源码然后重新打包了。有哪位大佬知道的?

2023-12-07 09:45 负责人:无 分享
已邀请:
套马杆的套子

套马杆的套子 - 没有解决不了的问题,只有解决不完的问题

这样试试,要不行,就放到renderjs里,我是在renderjs里用的

const script = document.createElement('script')  
            // script.src = "https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"  
            // script.type = "text/javascript"  
            script.src = "https://unpkg.com/leaflet-ant-path@1.3.0/dist/leaflet-ant-path.js"  
            script.type = "text/javascript"  
            script.onload = this.init.bind(this)  
            document.head.appendChild(script)
  • 独孤靖云 (作者)

    renderjs是一个运行在视图层的js。它比WXS更加强大。它只支持app-vue和web。

    renderjs不能用于小程序,我现在项目是三端的,APP、小程序、web

    2023-12-07 14:03

要回复问题请先登录注册