当前位置:网站首页>npm run dev启动项目报错 document is not defined
npm run dev启动项目报错 document is not defined
2022-07-06 13:21:00 【hongc93】
npm run dev启动项目报错 document is not defined 难解之题
背景:当接口调用失败要给用户个报错的弹出信息,给文件request.js中用import方式单独引入了element-ui下的Message和Message.box组件,报错 截图如下:
ReferenceError: document is not defined
at Object.<anonymous> (G:\cd\node_modules\element-ui\lib\utils\dom.js:22:39)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._compile (G:\cd\node_modules\pirates\lib\index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (G:\cd\node_modules\pirates\lib\index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (G:\cd\node_modules\element-ui\lib\utils\popup\popup-manager.js:9:12)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._compile (G:\cd\node_modules\pirates\lib\index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (G:\cd\node_modules\pirates\lib\index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:599:32
经过一点一点排查,发现别的引用request.js的接口文件都没有问题,只有login接口文件引用时报错。
各种查 原因是什么?未解 知道的大侠可以帮忙解惑下,谢谢
但是如果就是非要使用弹出组件 可以用下面的方法
//1.首先引入`vue`
import Vue from 'vue'
//2.创建vue的实例
let v = new Vue()
//3.通过vue实例调用组件
v.$message.success('内容')
终于大功告成!别了好久
边栏推荐
- 字符串的使用方法之startwith()-以XX开头、endsWith()-以XX结尾、trim()-删除两端空格
- uni-app App端半屏连续扫码
- KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
- What's the best way to get TFS to output each project to its own directory?
- Nodejs教程之让我们用 typescript 创建你的第一个 expressjs 应用程序
- 50个常用的Numpy函数解释,参数和使用示例
- 语谱图怎么看
- Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?
- 3D人脸重建:从基础知识到识别/重建方法!
- mysql根据两个字段去重
猜你喜欢
039. (2.8) thoughts in the ward
KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
50个常用的Numpy函数解释,参数和使用示例
20220211 failure - maximum amount of data supported by mongodb
Why does MySQL index fail? When do I use indexes?
MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
【滑动窗口】第九届蓝桥杯省赛B组:日志统计
ICML 2022 | flowformer: task generic linear complexity transformer
中国白酒的5场大战
966 minimum path sum
随机推荐
Word bag model and TF-IDF
3D人脸重建:从基础知识到识别/重建方法!
C # use Oracle stored procedure to obtain result set instance
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
Summary of cross partition scheme
El table table - sortable sorting & disordered sorting when decimal and% appear
在Pi和Jetson nano上运行深度网络,程序被Killed
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
How do I remove duplicates from the list- How to remove duplicates from a list?
Fzu 1686 dragon mystery repeated coverage
JS操作dom元素(一)——获取DOM节点的六种方式
ICML 2022 | Flowformer: 任务通用的线性复杂度Transformer
Start the embedded room: system startup with limited resources
document. Usage of write () - write text - modify style and position control
Absolute primes (C language)
FZU 1686 龙之谜 重复覆盖
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?
[go][reprint]vscode run a HelloWorld example after configuring go
[MySQL] basic use of cursor