【问题标题】:How to add cdn css file to Vue Cli 3 project?如何将 cdn css 文件添加到 Vue Cli 3 项目?
【发布时间】:2018-12-21 05:41:33
【问题描述】:

我试图在我的 vue-cli-3 项目中包含一个 cdn 外部 css 文件,所以我在 public/index.html 文件中添加了 css 文件,如下所示:

<link rel="stylesheet" href="http://mycssfile.css">

但是生成的index.html 文件中不包含css。这曾经在 vuejs2 中工作,我不明白为什么它不适用于 vuejs3。知道问题是什么吗?谢谢

【问题讨论】:

    标签: vue.js vue-cli


    【解决方案1】:

    这很简单。 在您的 main.vue 中添加以下内容

    <style>
      @import "https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css";
    </style>
    

    【讨论】:

    • 我将其添加到 App.vue 中
    • 也谢谢你!看来我做得不对。
    猜你喜欢
    • 2019-03-18
    • 1970-01-01
    • 2019-09-02
    • 2019-04-20
    • 2017-12-21
    • 2019-09-18
    • 1970-01-01
    • 2019-03-29
    • 2017-07-29
    相关资源
    最近更新 更多