无法在nuxt vue组件中导入引导程序 [英] Cannot import bootstrap in nuxt vue component
本文介绍了无法在nuxt vue组件中导入引导程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法在任何vue组件中导入引导程序(使用最新的nuxtjs).我得到了:
I can't import bootstrap in any vue component (using latest nuxtjs). I get :
我的(简单)组件是:
<template>
<h1>Empty index page</h1>
</template>
<script>
import Modal from 'bootstrap/js/src/modal'
export default {}
</script>
<style></style>
我真的很困.您有什么想法或建议吗?
I am really stuck. Do you have any idea or suggestion ?
推荐答案
您应该使用bootstrap-vue,它们可以解决很多问题,并且它们的树套工作也很棒.
You should use bootstrap-vue, they fix a lot of issues and their tree-shacking works amazing.
您的代码将是
<template>
<b-button v-b-modal.modal-1>Launch demo modal</b-button>
<b-modal id="modal-1" title="BootstrapVue" >
<h1>Empty index page</h1>
</b-modal>
</template>
<script>
import { BModal, BButton } from 'bootstrap-vue'
export default {
name: "Modal Component",
components: {
'b-modal': BModal,
'b-button': BButton
}
}
</script>
<style></style>
这篇关于无法在nuxt vue组件中导入引导程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文