带引导的VUE js模态不适用于我的vue项目

问题描述 投票:0回答:1

我在npm上安装了bootstrap,并采用了bootstrap的代码形式,并将其粘贴到我的代码中,但是它不起作用。我再走一个小时,但我不明白。

这是代码

<template>
<div>
    <!-- Button trigger modal -->
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
    Launch demo modal
    </button>

    <!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
        <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            ...
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary">Save changes</button>
        </div>
        </div>
    </div>
    </div>
</div>
</template>

enter image description here

如果我单击按钮,它既不会发出错误,也不会弹出窗口。我在哪里做错了?

This is the link of the bootstrap code I copy it. Is the Live demo

enter image description here

javascript vue.js bootstrap-modal
1个回答
1
投票

我想仅仅安装引导程序是不够的,因为您没有使用vue-bootstrap,因此必须配置jquery文件才能使其正常工作,这里是post逐步解释了它

© www.soinside.com 2019 - 2024. All rights reserved.