当前位置:网站首页>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('内容')终于大功告成!别了好久
边栏推荐
- 966 minimum path sum
- JS操作dom元素(一)——获取DOM节点的六种方式
- 在Pi和Jetson nano上运行深度网络,程序被Killed
- 红杉中国,刚刚募资90亿美元
- string的底层实现
- Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces
- KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
- 首批入选!腾讯安全天御风控获信通院业务安全能力认证
- ROS error: could not find a package configuration file provided by "move_base“
- Sdl2 source analysis 7: performance (sdl_renderpresent())
猜你喜欢

guava:Collections.unmodifiableXXX创建的collection并不immutable

Is this the feeling of being spoiled by bytes?
![[Li Kou brush questions] 32 Longest valid bracket](/img/51/1ce4f9e8517dba214ec82b6567c923.png)
[Li Kou brush questions] 32 Longest valid bracket

It's not my boast. You haven't used this fairy idea plug-in!

Why do job hopping take more than promotion?

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

OneNote in-depth evaluation: using resources, plug-ins, templates

Aike AI frontier promotion (7.6)

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

Data Lake (VIII): Iceberg data storage format
随机推荐
分糖果
Comparison between multithreaded CAS and synchronized
el-table表格——sortable排序 & 出现小数、%时排序错乱
[Li Kou brush questions] 32 Longest valid bracket
Study notes of grain Mall - phase I: Project Introduction
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅
This year, Jianzhi Tencent
js中,字符串和数组互转(二)——数组转为字符串的方法
document. Usage of write () - write text - modify style and position control
How to implement common frameworks
LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
guava: Multiset的使用
VIM basic configuration and frequently used commands
3D人脸重建:从基础知识到识别/重建方法!
在Pi和Jetson nano上运行深度网络,程序被Killed
嵌入式开发的7大原罪
Is it profitable to host an Olympic Games?
【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)
[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics
El table table - sortable sorting & disordered sorting when decimal and% appear