javascript - 元素 UI - 未知的自定义元素:- 您是否正确注册了组件?
问题描述
我用的是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)
})
解决方案
推荐阅读
- android-studio - Android Studio 的播放按钮未启用
- javascript - 仅自动滚动子组件,而不是父组件
- r - R中的字符串替换不正确
- ios - 使用 IOS 13 在 Xamarin.iOS 上向右滑动不会动画效果
- c# - Entity Framework Core 3 - 具有来自存储过程的一些字段的模型
- c# - OfType() 还是?
- javascript - IE Uncaught ReferenceError: jQ is not defined, but works in Chrome
- c# - C# 异步任务不会继续
- python - 如何使用 x/y/r 像素坐标裁剪图像?
- django - 使用 Django ORM 对它们的 FK 进行额外过滤,使用由多个列连接的不同模型的值更新对象