当前位置:网站首页>NPM run dev start project error document is not defined

NPM run dev start project error document is not defined

2022-07-06 21:41:00 hongc93

npm run dev Start up project error document is not defined A difficult problem

background : When the interface call fails, you should give the user an error pop-up message , Give the papers request.js of use import Method is introduced separately element-ui Under the Message and Message.box Components , Report errors The screenshot is as follows :

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

After checking bit by bit , Found other references request.js There is no problem with the interface files , Only login Interface file reference error .

All kinds of checks What's the reason ? Unsolved You know, great Xia, you can help solve your doubts , thank you

But if you just have to use pop-up components You can use the following methods

//1. First introduce `vue`
import Vue from 'vue'

//2. establish vue Example 
let v = new Vue()

//3. adopt vue Instance call component 
v.$message.success(' Content ')

It's finally done ! Goodbye for a long time

原网站

版权声明
本文为[hongc93]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061321473697.html