元素UI-未知的自定义元素:<el-drawer>-您是否正确注册了组件?

时间:2020-01-16 00:39:27

标签: javascript vue.js vue-component element

我正在使用元素ui模板,但是当添加一些组件(例如el-drawer)时,在我看来它尚未注册,

https://element.eleme.io/#/es/component/drawer

vue.runtime.esm.js:574 [Vue warn]: Unknown custom element: <el-drawer> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <Dashboard>
       <AppMain> at src/layout/components/AppMain.vue
         <Layout> at src/layout/index.vue
           <App> at src/App.vue
             <Root>

如何添加或修复它? 谢谢

模板:https://github.com/PanJiaChen/vue-admin-template 参考:https://element.eleme.io/#/es/component/quickstart#configuracion-global

main.js

/* eslint-disable */
import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import axios from 'axios'
import ElementUI from 'element-ui'

import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */
import { mockXHR } from '../mock'
if (process.env.NODE_ENV === 'production') {
  mockXHR()
}

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui,按如下方式声明
// Vue.use(ElementUI)

axios.defaults.baseURL='https://localhost:44340/'
//axios.defaults.baseURL='http://localhost/'
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

0 个答案:

没有答案
相关问题