赞
踩
我直接用cnpm i element-plus -S 装的版本,不知道为啥,一直报错 图1,版本型号 图2 ,我的代码中使用图3
我把package.json中的element-plus的版本更换成 下面这句话,解决了问题(是否为最新版本问题,还在求证中)
"element-plus": "^1.0.1-alpha.19",
(2)新加文件夹 plugins ,新建配置文件 element.js
- import 'element-plus/lib/theme-chalk/index.css'
- import ElementPlus from 'element-plus'
-
- const app = createApp(App)
- app.use(ElementPlus)
- app.use(store).use(router).mount('#app')
element.js:
- import {
- // ElAlert,
- ElAside,
- // ElAutocomplete,
- // ElAvatar,
- // ElBacktop,
- // ElBadge,
- // ElBreadcrumb,
- // ElBreadcrumbItem,
- ElButton,
- // ElButtonGroup,
- // ElCalendar,
- // ElCard,
- // ElCarousel,
- // ElCarouselItem,
- // ElCascader,
- // ElCascaderPanel,
- // ElCheckbox,
- // ElCheckboxButton,
- // ElCheckboxGroup,
- // ElCol,
- // ElCollapse,
- // ElCollapseItem,
- // ElCollapseTransition,
- // ElColorPicker,
- ElContainer,
- // ElDatePicker,
- // ElDialog,
- // ElDivider,
- // ElDrawer,
- ElDropdown,
- ElDropdownItem,
- ElDropdownMenu,
- // ElFooter,
- ElForm,
- ElFormItem,
- ElHeader,
- // ElIcon,
- // ElImage,
- ElInput,
- // ElInputNumber,
- // ElLink,
- ElMain,
- ElMenu,
- ElMenuItem,
- ElMenuItemGroup,
- // ElOption,
- // ElOptionGroup,
- // ElPageHeader,
- // ElPagination,
- ElPopconfirm,
- // ElPopover,
- ElPopper,
- // ElProgress,
- // ElRadio,
- // ElRadioButton,
- // ElRadioGroup,
- // ElRate,
- // ElRow,
- // ElScrollBar,
- // ElSelect,
- // ElSlider,
- // ElStep,
- // ElSteps,
- ElSubmenu,
- // ElSwitch,
- ElTabPane,
- ElTabs,
- // ElTable,
- // ElTableColumn,
- // ElTimeline,
- // ElTimelineItem,
- ElTooltip,
- // ElTransfer,
- // ElTree,
- // ElUpload,
- // ElInfiniteScroll,
- // ElLoading,
- // ElMessage,
- ElMessageBox,
- ElNotification
- } from 'element-plus'
- import lang from 'element-plus/lib/locale/lang/zh-cn'
- import locale from 'element-plus/lib/locale'
-
- export default (app) => {
- locale.use(lang)
- app.use(ElButton)
- app.use(ElNotification)
- app.use(ElContainer)
- app.use(ElAside)
- app.use(ElHeader)
- app.use(ElMain)
- app.use(ElDropdown)
- app.use(ElDropdownItem)
- app.use(ElDropdownMenu)
- app.use(ElTabPane)
- app.use(ElTabs)
- app.use(ElMenu)
- app.use(ElMenuItem)
- app.use(ElMenuItemGroup)
- app.use(ElSubmenu)
- app.use(ElTooltip)
- app.use(ElPopper)
- app.use(ElPopconfirm)
- app.use(ElMessageBox)
- app.use(ElInput)
- app.use(ElForm)
- app.use(ElFormItem)
- }
- import installElementPlus from './plugins/element.js'
- import 'element-plus/lib/theme-chalk/index.css'
-
- const app = createApp(App)
- installElementPlus(app)
- app.use(store).use(router).mount('#app')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。