How to embed font to all page with nuxt js

后端 未结 5 1800
心在旅途
心在旅途 2021-01-04 12:51

I just embed google font to the global setting in nuxt.config.js

 link: [
      { rel: \'stylesheet\', href: \'https://fonts.googleapis.com/css?family=Roboto         


        
5条回答
  •  时光说笑
    2021-01-04 13:17

    It is simple like this

    1. Go to Google fonts and select your font style e.g Montserrat

    2. Got to nuxt.config.js and add your font url as shown here

    export default {  
     head: {
            meta: [],
              link: [
           { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Montserrat&display=swap"'}
         ]
       }
    
    1. Go to your nuxt project -> layouts directory -> default.vue file and add class named app ( or whatever name you want) in v-app tag as shown here
      
    
          --your app goes here -- 
    
      
    
    1. In the same file style option add the following lines in the class body you defined above

       
      

      Make sure class is defined in v-app tag and use