这就是我在 app.vue 中使用 bootstrap 的方式
<template>
<div>
<b-button v-b-modal.modal-1>Launch demo modal</b-button>
<b-modal id="modal-1" title="BootstrapVue">
<p class="my-4">Hello from modal!</p>
</b-modal>
</div>
</template>
<script>
import { BModal } from 'bootstrap-vue'
export default {
name: 'App',
components: {
BModal,
},
}
</script>
在 main.js 中,我导入了这样的引导程序
import { createApp } from 'vue'
import App from './App.vue'
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-vue/dist/bootstrap-vue.css';
const app = createApp(App);
app.mount('#app');
在 package.json 中也添加了 Bootstrap 依赖
"dependencies": {
"@vue/compat": "^3.2.47",
"bootstrap-vue": "^2.23.1",
"core-js": "^3.8.3",
"vue": "^3.2.13"
},