How do I add a Google Font to a VueJS Component?

前端 未结 7 1918
离开以前
离开以前 2021-02-03 20:42

I\'ve been trying for an hour to find a way to import a Google Font into a VueJS Component, but I cannot seem to find a solution, nothing worked yet, not even the stuff from pre

相关标签:
7条回答
  • 2021-02-03 21:35

    The fastest way is to import the font in a CSS file, for example App.css, if all components should have it:

    @import url('https://fonts.googleapis.com/css?family=Roboto+Condensed');
    
    html, body {
      font-family: 'Roboto', sans-serif;
    }
    
    #app {
      font-family: 'Roboto', sans-serif;
    }
    

    The import statement is also shown by Google Fonts.

    Select your fonts, click on Embed and then @import at the selection window:

    0 讨论(0)
提交回复
热议问题