当前位置:网站首页>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('内容')
终于大功告成!别了好久
边栏推荐
- numpy 下载安装
- Quick access to video links at station B
- Why do job hopping take more than promotion?
- Z function (extended KMP)
- Redistemplate common collection instructions opsforset (V)
- How to implement common frameworks
- [interpretation of the paper] machine learning technology for Cataract Classification / classification
- el-table表格——获取单击的是第几行和第几列 & 表格排序之el-table与sort-change、el-table-column与sort-method & 清除排序-clearSort
- 互联网快讯:吉利正式收购魅族;胰岛素集采在31省全面落地
- Redistemplate common collection instructions opsforlist (III)
猜你喜欢
After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
JPEG2000-Matlab源码实现
Is it profitable to host an Olympic Games?
It's not my boast. You haven't used this fairy idea plug-in!
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅
LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
Interviewer: what is the internal implementation of ordered collection in redis?
guava:Collections.unmodifiableXXX创建的collection并不immutable
[interpretation of the paper] machine learning technology for Cataract Classification / classification
随机推荐
R3live notes: image processing section
Technology sharing | packet capturing analysis TCP protocol
el-table表格——sortable排序 & 出现小数、%时排序错乱
[interpretation of the paper] machine learning technology for Cataract Classification / classification
爬虫实战(五):爬豆瓣top250
【力扣刷题】32. 最长有效括号
MySQL - transaction details
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
js 根据汉字首字母排序(省份排序) 或 根据英文首字母排序——za排序 & az排序
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?
This year, Jianzhi Tencent
How do I remove duplicates from the list- How to remove duplicates from a list?
The underlying implementation of string
C语言:#if、#def和#ifndef综合应用
Why do job hopping take more than promotion?
R language for text mining Part4 text classification
KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
麦趣尔砸了小众奶招牌