VUE中添加elementUI

  • Post author:
  • Post category:vue


安装

npm install element-ui --save

main.js中添加引用

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

目前(2021.4.20)elementUI还不持支Vue3,如果选择创建使用的Vue3需要更换成Vue2

报错信息如下

Uncaught TypeError: Cannot read property ‘prototype’ of undefined

at eval (dom.js?5924:19)

at Object../node_modules/element-ui/lib/utils/dom.js (chunk-vendors.js:2673)

at __webpack_require__ (app.js:854)

at fn (app.js:151)

at eval (popup-manager.js?4b26:9)

at Object../node_modules/element-ui/lib/utils/popup/popup-manager.js (chunk-vendors.js:2721)

at __webpack_require__ (app.js:854)

at fn (app.js:151)

at eval (index.js?5128:14)

at Object../node_modules/element-ui/lib/utils/popup/index.js (chunk-vendors.js:2709)

eval @ dom.js?5924:19

./node_modules/element-ui/lib/utils/dom.js @ chunk-vendors.js:2673

__webpack_require__ @ app.js:854

fn @ app.js:151

eval @ popup-manager.js?4b26:9

./node_modules/element-ui/lib/utils/popup/popup-manager.js @ chunk-vendors.js:2721

__webpack_require__ @ app.js:854

fn @ app.js:151

eval @ index.js?5128:14

./node_modules/element-ui/lib/utils/popup/index.js @ chunk-vendors.js:2709

__webpack_require__ @ app.js:854

fn @ app.js:151

eval @ vue-popper.js?e974:9

./node_modules/element-ui/lib/utils/vue-popper.js @ chunk-vendors.js:2817

__webpack_require__ @ app.js:854

fn @ app.js:151

5 @ select.js?4e4b:523

__webpack_require__ @ select.js?4e4b:21

61 @ select.js?4e4b:1053

__webpack_require__ @ select.js?4e4b:21

eval @ select.js?4e4b:85

eval @ select.js?4e4b:88

./node_modules/element-ui/lib/select.js @ chunk-vendors.js:2522

__webpack_require__ @ app.js:854

fn @ app.js:151

eval @ element-ui.common.js?5c96:308

__webpack_require__ @ element-ui.common.js?5c96:21

eval @ element-ui.common.js?5c96:735

__webpack_require__ @ element-ui.common.js?5c96:21

eval @ element-ui.common.js?5c96:362

__webpack_require__ @ element-ui.common.js?5c96:21

eval @ element-ui.common.js?5c96:85

eval @ element-ui.common.js?5c96:88

./node_modules/element-ui/lib/element-ui.common.js @ chunk-vendors.js:2350

__webpack_require__ @ app.js:854

fn @ app.js:151

eval @ main.js:14

./src/main.js @ app.js:1217

__webpack_require__ @ app.js:854

fn @ app.js:151

1 @ app.js:1290

__webpack_require__ @ app.js:854

checkDeferredModules @ app.js:46

(匿名) @ app.js:994

(匿名) @ app.js:997

再显示15 个框架

sockjs.js?9be2:1609 GET

http://192.168.1.41:8080/sockjs-node/info?t=1618890115542

net::ERR_CONNECTION_REFUSED

AbstractXHRObject._start @ sockjs.js?9be2:1609

eval @ sockjs.js?9be2:1498

setTimeout(异步)

AbstractXHRObject @ sockjs.js?9be2:1497

XHRCorsObject @ sockjs.js?9be2:2875

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout(异步)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:734

SockJSClient @ SockJSClient.js?0a33:43

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout(异步)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:973

setTimeout(异步)

SockJS._close @ sockjs.js?9be2:961

SockJS._transportMessage @ sockjs.js?9be2:901

EventEmitter.emit @ sockjs.js?9be2:86

WebSocketTransport.ws.onmessage @ sockjs.js?9be2:2965

sockjs.js?9be2:1609 GET

http://192.168.1.41:8080/sockjs-node/info?t=1618890119597

net::ERR_CONNECTION_REFUSED

AbstractXHRObject._start @ sockjs.js?9be2:1609

eval @ sockjs.js?9be2:1498

setTimeout(异步)

AbstractXHRObject @ sockjs.js?9be2:1497

XHRCorsObject @ sockjs.js?9be2:2875

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout(异步)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:734

SockJSClient @ SockJSClient.js?0a33:43

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout(异步)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:973

setTimeout(异步)

SockJS._close @ sockjs.js?9be2:961

SockJS._receiveInfo @ sockjs.js?9be2:790

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:567

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:374

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

xhr.onreadystatechange @ sockjs.js?9be2:1601

XMLHttpRequest.send(异步)

AbstractXHRObject._start @ sockjs.js?9be2:1609

eval @ sockjs.js?9be2:1498

setTimeout(异步)

AbstractXHRObject @ sockjs.js?9be2:1497

XHRCorsObject @ sockjs.js?9be2:2875

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout(异步)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:734

SockJSClient @ SockJSClient.js?0a33:43

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout(异步)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:973

setTimeout(异步)

SockJS._close @ sockjs.js?9be2:961

SockJS._transportMessage @ sockjs.js?9be2:901

EventEmitter.emit @ sockjs.js?9be2:86

WebSocketTransport.ws.onmessage @ sockjs.js?9be2:2965

sockjs.js?9be2:1609 GET

http://192.168.1.41:8080/sockjs-node/info?t=1618890125655

net::ERR_CONNECTION_REFUSED

AbstractXHRObject._start @ sockjs.js?9be2:1609

eval @ sockjs.js?9be2:1498

setTimeout(异步)

AbstractXHRObject @ sockjs.js?9be2:1497

XHRCorsObject @ sockjs.js?9be2:2875

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout(异步)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:734

SockJSClient @ SockJSClient.js?0a33:43

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout(异步)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:973

setTimeout(异步)

SockJS._close @ sockjs.js?9be2:961

SockJS._receiveInfo @ sockjs.js?9be2:790

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:567

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:374

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

xhr.onreadystatechange @ sockjs.js?9be2:1601

XMLHttpRequest.send(异步)

AbstractXHRObject._start @ sockjs.js?9be2:1609

eval @ sockjs.js?9be2:1498

setTimeout(异步)

AbstractXHRObject @ sockjs.js?9be2:1497

XHRCorsObject @ sockjs.js?9be2:2875

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout(异步)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:734

SockJSClient @ SockJSClient.js?0a33:43

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout(异步)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:973

setTimeout(异步)

SockJS._close @ sockjs.js?9be2:961

SockJS._receiveInfo @ sockjs.js?9be2:790

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:567

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

eval @ sockjs.js?9be2:374

g @ sockjs.js?9be2:66

EventEmitter.emit @ sockjs.js?9be2:86

xhr.onreadystatechange @ sockjs.js?9be2:1601

XMLHttpRequest.send(异步)

AbstractXHRObject._start @ sockjs.js?9be2:1609

eval @ sockjs.js?9be2:1498

setTimeout(异步)

AbstractXHRObject @ sockjs.js?9be2:1497

XHRCorsObject @ sockjs.js?9be2:2875

InfoAjax @ sockjs.js?9be2:356

InfoReceiver._getReceiver @ sockjs.js?9be2:539

InfoReceiver.doXhr @ sockjs.js?9be2:556

eval @ sockjs.js?9be2:525

setTimeout(异步)

InfoReceiver @ sockjs.js?9be2:524

SockJS @ sockjs.js?9be2:734

SockJSClient @ SockJSClient.js?0a33:43

initSocket @ socket.js?e29c:20

eval @ socket.js?e29c:39

setTimeout(异步)

eval @ socket.js?e29c:38

EventTarget.dispatchEvent @ sockjs.js?9be2:170

eval @ sockjs.js?9be2:973

setTimeout(异步)

SockJS._close @ sockjs.js?9be2:961

SockJS._transportMessage @ sockjs.js?9be2:901

EventEmitter.emit @ sockjs.js?9be2:86

WebSocketTransport.ws.onmessage @ sockjs.js?9be2:2965

sockjs.js?9be2:1609 GET

http://192.168.1.41:8080/sockjs-node/info?t=1618890135677

net::ERR_CONNECTION_REFUSED



版权声明:本文为shaynerain原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。