nuxt 2.0采坑计之 (引入静态文件css)

nuxt 2.0采坑计之静态文件css

外部引入css

全局引用方法为   (在nuxt.config.js配置中在   module.exports = {}  中添加)

 head: {
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      { rel: 'stylesheet', href:   'https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css'},   //外部引入css方式
    
{ rel: 'stylesheet', href: '/css/phone-reset.css'} // 内部引入会默认读取(static文件夹)
] },

局部引入css   (在需要引入的vue文件里  module.exports = {} 中添加)

head:{
    link : [
            { rel: 'stylesheet', href: '/css/index.css'}   // 内部引入会默认读取
     ]
},
原文地址:https://www.cnblogs.com/hpx2020/p/9766312.html