如何将 cdn css 文件添加到 Vue Cli 3 项目?
How to add cdn css file to Vue Cli 3 project?
我试图在我的 vue-cli-3 项目中包含一个 cdn 外部 css 文件,所以我在 public/index.html
文件中添加了 css 文件,如下所示:
<link rel="stylesheet" href="http://mycssfile.css">
但是 css 没有包含在生成的 index.html
文件中。这曾经在 vuejs2 中工作,我不明白为什么它不适用于 vuejs3。知道问题是什么吗?谢谢
很简单。
在您的 main.vue 上添加以下内容
<style>
@import "https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css";
</style>
我试图在我的 vue-cli-3 项目中包含一个 cdn 外部 css 文件,所以我在 public/index.html
文件中添加了 css 文件,如下所示:
<link rel="stylesheet" href="http://mycssfile.css">
但是 css 没有包含在生成的 index.html
文件中。这曾经在 vuejs2 中工作,我不明白为什么它不适用于 vuejs3。知道问题是什么吗?谢谢
很简单。 在您的 main.vue 上添加以下内容
<style>
@import "https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css";
</style>