I downloaded npm packages according to requirements from https://bootstrap-vue.org/vue3 so in package.json file I have:
"dependencies": {
"bootstrap": "^4.0.0",
"bootstrap-vue": "^2.23.1",
},
In main.js I have:
import { createApp } from 'vue'
import App from './App.vue'
import { BootstrapVue} from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
createApp(App).use(BootstrapVue).mount('#app')
I doesn't work. I get sush error:
Uncaught TypeError: Cannot read properties of undefined (reading 'version')
This package isn't 100% compatible with Vue 3 yet. It's the vue 2 version running with a compatibility library to port it to Vue 3.
You need to install @vue/compat
too, according to the same documentation you mentioned.
"@vue/compat": "^3.2.41",
Look at their example sandbox for Vue3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.