vue3.0引入vant报错Uncaught TypeError: Cannot read property 'use' of undefined

一、代码:

vue3.0引入vant框架一直报错,不管是全局引入还是按需引入效果都不对,下面是在main.js页面全局引入vant的代码:

// main.js页面
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vue from 'vue'

import 'vant/lib/button/style';
import Vant from 'vant'
import 'vant/lib/index.css'

Vue.use(Vant)

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

二、报错如下:

image.png

三、解决办法:

image.png
// main.js页面
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vue from 'vue'

import 'vant/lib/button/style';
import Vant from 'vant'
import 'vant/lib/index.css'

createApp(App).use(store).use(router).use(Vant).mount('#app')

页面效果:

image.png

你可能感兴趣的:(vue3.0引入vant报错Uncaught TypeError: Cannot read property 'use' of undefined)