亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue中按需加載element-ui模塊報錯

vue中按需加載element-ui模塊報錯

達令說 2018-09-08 16:06:40
問題描述開發項目中使用了vue+element-ui,在按需加載elementui模塊時這樣寫就會報錯,我加載了以下三個模塊。import {Message, Select, Cascader} from 'element-ui';控制臺報錯:[Vue warn]: Unknown custom element: <el-option> - did you register the component correctly? For recursive components, make sure to provide the "name" option.上面提示的錯誤是與Select模塊有關,所以最開始我以為是Select模塊的問題,所以我就把Select模塊禁用了。import { Message, Cascader } from 'element-ui';雖然沒有報錯,但是Message的警告樣式會在我頁面一刷新時就出現,正常情況下應該在觸發事件時才出現。然后我又禁用了Message模塊,報了同樣的錯誤??刂婆_報錯:[Vue warn]: Unknown custom element: <el-option> - did you register the component correctly? For recursive components, make sure to provide the "name" option.之后我又多次嘗試各種寫法,最后我將Message模塊挑出來單獨引入,沒有報錯并且顯示正常。import Message from 'element-ui';import { Select, Cascader } from 'element-ui';但是會出現‘element-ui’多次入口的警告。這里要提一下,我在多個頁面都按需加載了elementUI的其他模塊,并沒有出現錯誤或警告。這里想請教大家有沒有遇到類似問題,該如何解決?
查看完整描述

1 回答

?
千巷貓影

TA貢獻1829條經驗 獲得超7個贊

提示都給你了,只是沒引入Option組件而已。。。

import {Message, Select, Option, Cascader} from 'element-ui';


查看完整回答
1 反對 回復 2018-09-09
  • qq_慕沐3393688
    qq_慕沐3393688
    沒引入Option之前 代碼: import { Button,Select} from 'element-ui'; Vue.use(Button) Vue.use(Select) 報錯:1.nknown custom element:<el-option> - did you register the component correctly? For recursive components, make sure to provide the "name" option. 2.Unknown custom element: <el-row> - did you register the component correctly? For recursive components, make sure to provide the "name" option. ------------------- 引入Option 代碼:import { Button,Option,Select} from 'element-ui'; Vue.use(Button) Vue.use(Select) Vue.use(Option) 報錯:Unknown custom element: <el-row> - did you register the component correctly? For recursive components, make sure to provide the "name" option. ------------ 只把 Select 的報錯去掉了 ,我引入其它的 也報錯 ,為甚莫
  • 1 回答
  • 0 關注
  • 17275 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號