当前位置:网站首页>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('内容')终于大功告成!别了好久
边栏推荐
- Reference frame generation based on deep learning
- js中,字符串和数组互转(一)——字符串转为数组的方法
- [go][reprint]vscode run a HelloWorld example after configuring go
- LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
- VIM basic configuration and frequently used commands
- Nodejs tutorial let's create your first expressjs application with typescript
- 038. (2.7) less anxiety
- 在最长的距离二叉树结点
- document.write()的用法-写入文本——修改样式、位置控制
- Quick access to video links at station B
猜你喜欢

KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
![[MySQL] basic use of cursor](/img/cc/39b1e17b48d0de641d3cbffbf2335a.png)
[MySQL] basic use of cursor

【滑动窗口】第九届蓝桥杯省赛B组:日志统计

jvm:大对象在老年代的分配

Caching strategies overview
![[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)](/img/1c/973f824f061d470a4079487d75f0d0.png)
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)

红杉中国,刚刚募资90亿美元

039. (2.8) thoughts in the ward

Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit

MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
随机推荐
【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
JPEG2000 matlab source code implementation
MySQL - 事务(Transaction)详解
JS操作dom元素(一)——获取DOM节点的六种方式
14 years Bachelor degree, transferred to software testing, salary 13.5k
Data Lake (VIII): Iceberg data storage format
[Li Kou brush questions] 32 Longest valid bracket
Ravendb starts -- document metadata
R language for text mining Part4 text classification
Comparison between multithreaded CAS and synchronized
【论文解读】用于白内障分级/分类的机器学习技术
Hill | insert sort
抖音将推独立种草App“可颂”,字节忘不掉小红书?
JS learning notes OO create suspicious objects
968 edit distance
El table table - sortable sorting & disordered sorting when decimal and% appear
Caching strategies overview
Proxy and reverse proxy
2017 8th Blue Bridge Cup group a provincial tournament
Swagger UI tutorial API document artifact