为 sweet-alert2 加载 CSS bootstrap-4 主题

问题描述

我的项目使用 SweetAlert2。我在 webpack 中使用 VueJS 和 vue-cli-service。

因为我想使用 boostrap-4 主题,所以我按照说明进行操作:

npm i npm install @sweetalert2/theme-bootstrap-4

我在 index.html 中包含了这个 css

<link rel="stylesheet" href="@sweetalert2/themes/bootstrap-4/bootstrap-4.css">

但它只会导致 404 错误,当然,主题没有显示。我似乎不明白它应该如何工作以及出了什么问题。

感谢您的帮助。

解决方法

根据您需要使用的 README of @sweetalert2/theme-bootstrap-4

<link rel="stylesheet" href="@sweetalert2/theme-bootstrap-4/bootstrap-4.css">