当前位置:网站首页>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('内容')终于大功告成!别了好久
边栏推荐
- 袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求
- Quick news: the flybook players' conference is held online; Wechat payment launched "education and training service toolbox"
- 【力扣刷题】32. 最长有效括号
- 中国白酒的5场大战
- 3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
- KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
- Comparison between multithreaded CAS and synchronized
- What's the best way to get TFS to output each project to its own directory?
- After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
- 跨分片方案 总结
猜你喜欢

【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)

for循环中break与continue的区别——break-完全结束循环 & continue-终止本次循环

Data Lake (VIII): Iceberg data storage format

50个常用的Numpy函数解释,参数和使用示例

Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?

快讯:飞书玩家大会线上举行;微信支付推出“教培服务工具箱”

2022 fields Award Announced! The first Korean Xu Long'er was on the list, and four post-80s women won the prize. Ukrainian female mathematicians became the only two women to win the prize in history

HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother

Is this the feeling of being spoiled by bytes?

Reference frame generation based on deep learning
随机推荐
基于深度学习的参考帧生成
First batch selected! Tencent security tianyufeng control has obtained the business security capability certification of the ICT Institute
2022 fields Award Announced! The first Korean Xu Long'er was on the list, and four post-80s women won the prize. Ukrainian female mathematicians became the only two women to win the prize in history
How do I remove duplicates from the list- How to remove duplicates from a list?
MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地
js 根据汉字首字母排序(省份排序) 或 根据英文首字母排序——za排序 & az排序
JS traversal array and string
Web开发小妙招:巧用ThreadLocal规避层层传值
Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)
Torch Cookbook
Nodejs tutorial let's create your first expressjs application with typescript
string的底层实现
[go][转载]vscode配置完go跑个helloworld例子
R语言做文本挖掘 Part4文本分类
967- letter combination of telephone number
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
JS learning notes OO create suspicious objects
document. Usage of write () - write text - modify style and position control
首批入选!腾讯安全天御风控获信通院业务安全能力认证