Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I am using the element ui template, but when adding some components such as el-drawer, it appears to me that it is not registered,
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
How can I add or fix it?
Thank you
Template: https://github.com/PanJiaChen/vue-admin-template
ref: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)
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.