当前位置:网站首页>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('内容')终于大功告成!别了好久
边栏推荐
- 【Redis设计与实现】第一部分 :Redis数据结构和对象 总结
- 跨分片方案 总结
- 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
- @GetMapping、@PostMapping 和 @RequestMapping详细区别附实战代码(全)
- Is it profitable to host an Olympic Games?
- Set up a time server
- Binary tree node at the longest distance
- 分糖果
- Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?
- Nodejs教程之Expressjs一篇文章快速入门
猜你喜欢

Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces

缓存更新策略概览(Caching Strategies Overview)

Caching strategies overview

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

Absolute primes (C language)

抖音将推独立种草App“可颂”,字节忘不掉小红书?
![[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics](/img/2d/9a7e88fb774984d061538e3ad4a96b.png)
[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics
![[interpretation of the paper] machine learning technology for Cataract Classification / classification](/img/0c/b76e59f092c1b534736132faa76de5.png)
[interpretation of the paper] machine learning technology for Cataract Classification / classification

Is it profitable to host an Olympic Games?

This year, Jianzhi Tencent
随机推荐
语谱图怎么看
It's almost the new year, and my heart is lazy
跨分片方案 总结
[interpretation of the paper] machine learning technology for Cataract Classification / classification
string的底层实现
c语言char, wchar_t, char16_t, char32_t和字符集的关系
Caching strategies overview
[Li Kou brush questions] 32 Longest valid bracket
Nodejs教程之Expressjs一篇文章快速入门
js中,字符串和数组互转(二)——数组转为字符串的方法
uni-app App端半屏连续扫码
The use method of string is startwith () - start with XX, endswith () - end with XX, trim () - delete spaces at both ends
Internet News: Geely officially acquired Meizu; Intensive insulin purchase was fully implemented in 31 provinces
Word bag model and TF-IDF
【深度学习】PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
3D人脸重建:从基础知识到识别/重建方法!
First batch selected! Tencent security tianyufeng control has obtained the business security capability certification of the ICT Institute
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
ROS error: could not find a package configuration file provided by "move_base“