当前位置:网站首页>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('内容')终于大功告成!别了好久
边栏推荐
- It's not my boast. You haven't used this fairy idea plug-in!
- 首批入选!腾讯安全天御风控获信通院业务安全能力认证
- Thinking about agile development
- 2017 8th Blue Bridge Cup group a provincial tournament
- el-table表格——sortable排序 & 出现小数、%时排序错乱
- Summary of cross partition scheme
- C # use Oracle stored procedure to obtain result set instance
- ACdreamoj1110(多重背包)
- How to implement common frameworks
- 缓存更新策略概览(Caching Strategies Overview)
猜你喜欢

uni-app App端半屏连续扫码

MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.

KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning

3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
![[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

Summary of cross partition scheme

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

【力扣刷题】一维动态规划记录(53零钱兑换、300最长递增子序列、53最大子数组和)

愛可可AI前沿推介(7.6)

抖音將推獨立種草App“可頌”,字節忘不掉小紅書?
随机推荐
JS traversal array and string
Aiko ai Frontier promotion (7.6)
14 years Bachelor degree, transferred to software testing, salary 13.5k
Forward maximum matching method
js通过数组内容来获取数组下标
uni-app App端半屏连续扫码
Fastjson parses JSON strings (deserialized to list, map)
JS learning notes OO create suspicious objects
【深度学习】PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics
Yuan Xiaolin: safety is not only a standard, but also Volvo's unchanging belief and pursuit
Dialogue with Jia Yangqing, vice president of Alibaba: pursuing a big model is not a bad thing
In JS, string and array are converted to each other (I) -- the method of converting string into array
guava:创建immutableXxx对象的3种方式
js之遍历数组、字符串
What's the best way to get TFS to output each project to its own directory?
Redistemplate common collection instructions opsforhash (IV)
The underlying implementation of string
JS operation DOM element (I) -- six ways to obtain DOM nodes
Hill | insert sort