当前位置:网站首页>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('内容')终于大功告成!别了好久
边栏推荐
- Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?
- for循环中break与continue的区别——break-完全结束循环 & continue-终止本次循环
- ICML 2022 | Flowformer: 任务通用的线性复杂度Transformer
- [in depth learning] pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
- js 根据汉字首字母排序(省份排序) 或 根据英文首字母排序——za排序 & az排序
- JS according to the Chinese Alphabet (province) or according to the English alphabet - Za sort &az sort
- Why do job hopping take more than promotion?
- MySQL - transaction details
- 跨分片方案 总结
- Fzu 1686 dragon mystery repeated coverage
猜你喜欢

Z function (extended KMP)

Interviewer: what is the internal implementation of ordered collection in redis?

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

中国白酒的5场大战

numpy 下载安装

Data Lake (VIII): Iceberg data storage format

【力扣刷题】32. 最长有效括号

愛可可AI前沿推介(7.6)

Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)

Fastjson parses JSON strings (deserialized to list, map)
随机推荐
50个常用的Numpy函数解释,参数和使用示例
js之遍历数组、字符串
Reference frame generation based on deep learning
R语言做文本挖掘 Part4文本分类
Is it profitable to host an Olympic Games?
966 minimum path sum
通过数字电视通过宽带网络取代互联网电视机顶盒应用
JS学习笔记-OO创建怀疑的对象
Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
[go][转载]vscode配置完go跑个helloworld例子
Four common ways and performance comparison of ArrayList de duplication (jmh performance analysis)
Binary tree node at the longest distance
The difference between break and continue in the for loop -- break completely end the loop & continue terminate this loop
抖音将推独立种草App“可颂”,字节忘不掉小红书?
This year, Jianzhi Tencent
中国白酒的5场大战
爱可可AI前沿推介(7.6)
FZU 1686 龙之谜 重复覆盖
ROS error: could not find a package configuration file provided by "move_base“
快讯:飞书玩家大会线上举行;微信支付推出“教培服务工具箱”