如何在 Vue 中加载外部 CSS [英] How to load external CSS in Vue

查看:32
本文介绍了如何在 Vue 中加载外部 CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Vue 项目,其中 Typescript 具有类样式的组件.我需要包含一些外部 CSS 文件 - 比如来自 Amazon S3.似乎没有加载 CSS.

I have created a Vue project with Typescript having components in class style. I need to include some external CSS file - like from Amazon S3. The CSS doesn't seems to be loaded.

在网络部分我可以看到它.

In the network section I can see it.

推荐答案

可以加载外部 URL

you can load external URL

<style lang="scss or less">
    @import "https://external_url_.css";
    @import ".../assest/_.css";
</style>

如果你更多的话,你可以加载 css 加载器,比如 sass-loader, css-loader , less-loader npm

you can load css loaders installed if you more such as sass-loader, css-loader , less-loader npm

这篇关于如何在 Vue 中加载外部 CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆