当前位置:网站首页>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('内容')
终于大功告成!别了好久
边栏推荐
- FZU 1686 龙之谜 重复覆盖
- Is this the feeling of being spoiled by bytes?
- 2022菲尔兹奖揭晓!首位韩裔许埈珥上榜,四位80后得奖,乌克兰女数学家成史上唯二获奖女性
- 嵌入式开发的7大原罪
- [redis design and implementation] part I: summary of redis data structure and objects
- The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
- Is it profitable to host an Olympic Games?
- Vim 基本配置和经常使用的命令
- 在Pi和Jetson nano上运行深度网络,程序被Killed
- Quick news: the flybook players' conference is held online; Wechat payment launched "education and training service toolbox"
猜你喜欢
Seven original sins of embedded development
Aike AI frontier promotion (7.6)
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
3D人脸重建:从基础知识到识别/重建方法!
JPEG2000-Matlab源码实现
for循环中break与continue的区别——break-完全结束循环 & continue-终止本次循环
Summary of cross partition scheme
Shake Sound poussera l'application indépendante de plantation d'herbe "louable", les octets ne peuvent pas oublier le petit livre rouge?
基于深度学习的参考帧生成
麦趣尔砸了小众奶招牌
随机推荐
2017 8th Blue Bridge Cup group a provincial tournament
Quick access to video links at station B
guava:Collections.unmodifiableXXX创建的collection并不immutable
Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
document. Usage of write () - write text - modify style and position control
R语言做文本挖掘 Part4文本分类
14年本科毕业,转行软件测试,薪资13.5K
Yyds dry inventory run kubeedge official example_ Counter demo counter
通过数字电视通过宽带网络取代互联网电视机顶盒应用
爬虫实战(五):爬豆瓣top250
红杉中国,刚刚募资90亿美元
KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
跨分片方案 总结
el-table表格——获取单击的是第几行和第几列 & 表格排序之el-table与sort-change、el-table-column与sort-method & 清除排序-clearSort
[MySQL] trigger
【滑动窗口】第九届蓝桥杯省赛B组:日志统计
50个常用的Numpy函数解释,参数和使用示例
Absolute primes (C language)
Common English vocabulary that every programmer must master (recommended Collection)
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)