uni-app nvue 不能使用require 引入模块,报没有require,页面全部采用nvue开发, 卡在这里了,require引用第三方的框架,引入不了,急

小听众
- 发布:2019-12-29 18:39
- 更新:2023-05-15 17:50
- 阅读:7525
【报Bug】uni-app nvue 不能使用require 引入模块
分类:uni-app

可以通过将外部js挂载到App实例上来使用:
- 在App.vue中引入并挂载外部js
const biz = require('./business'); export default { onLaunch: async function() { this.mybiz = biz; } }
- 在nvue页面中使用:
// 任意函数里面 getApp().mybiz.hello();

请问解决了么,我也遇到这样的情况了

Diligent_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序
使用import导入呗
Kytrun
可以是可以,但是操作麻烦,而且纯 nvue 不支持
2022-06-28 11:24
秃头码农哥
在App.vue中也会报错
2022-08-16 20:53