[Vuejs]-Can't add TimePicker component from 'element-ui' library. How To add it correctly?

0šŸ‘

I found the problem. In my case, the name of the component that I was using in ā€˜templateā€™ was wrong. I named it as ā€œtime-pickerā€ instead of ā€œel-time-pickerā€

Donā€™t forger to add prefix ā€˜el-ā€˜ to the name of your components when using them in your <template>-s.

Full answer:

1)To add component globally to your app, add to your js file this code (the names of the components and other examples you can fined here ):

import { TimePicker } from 'element-ui'
import lang from 'element-ui/lib/locale/lang/en'
import locale from 'element-ui/lib/locale'

// configure language
locale.use(lang)

// import components
Vue.component(TimePicker.name, TimePicker)
  1. Add new component to your vue.js file, in <templete> section.:

    <el-time-picker></el-time-picker>

Leave a comment