国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Vue與element聯(lián)動踩過的坑

2021-05-08 15:26 作者:忘魂兒  | 我要投稿

vue最新版本中創(chuàng)建的實例對象是createApp

而我們正常按照官方文檔進行安裝的element-ui,只支持實例對象為Vue

所以問題就出在了這里

如果你的實例對象是Vue的話,

vue create my-app

cd?my-app

vue add element

然后再在main.js中引入即可

import Vue from 'vue';

import ElementUI from 'element-ui';

import 'element-ui/lib/theme-chalk/index.css';

import App from './App.vue';?

Vue.use(ElementUI);

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

如果你的實例對象是createApp,

我看別的大佬都教你降低版本,讓你卸載,安一個兼容的版本

我就不一樣了直接用element-plus的方法來引入element-ui就好了嘛

vue create my-app

cd?my-app

vue add element-plus

npm install vue-cli-plugin-element-plus

在main.js中

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'element-ui/lib/theme-chalk/index.css'
import installElementPlus from './plugins/element'

const app = createApp(App)
installElementPlus(app)
app.use(store).use(router).mount('#app')

下面我以走馬燈(輪播圖示例如何使用)

<template>
<div id="swiper">
?<el-carousel height="300px" id="imgs">
? ?<el-carousel-item ?v-for="(item,index) in banners" :key="index">
? ? ?<a :href="item.link">-->
? ? ? ? ? ?<img :src="item.image" alt="">
? ? ?</a>
? ?</el-carousel-item>
?</el-carousel>
</div>
</template>


好了,散會!

Vue與element聯(lián)動踩過的坑的評論 (共 條)

分享到微博請遵守國家法律
修水县| 齐齐哈尔市| 三穗县| 伊吾县| 阜康市| 城固县| 漯河市| 邹城市| 甘南县| 上虞市| 葵青区| 崇信县| 武陟县| 林口县| 夏河县| 兴安县| 卢湾区| 榕江县| 洛南县| 宜春市| 当阳市| 永年县| 且末县| 霍邱县| 班戈县| 青冈县| 仁化县| 哈巴河县| 宁海县| 九寨沟县| 长春市| 江永县| 平山县| 灵武市| 福鼎市| 镇坪县| 大悟县| 内丘县| 平遥县| 金山区| 龙游县|