调用Nuxt JS静态文件

时间:2019-12-21 14:41:07

标签: javascript vue.js nuxt.js

我尝试调用我在静态目录中拥有的css文件,但收到错误消息

/* style not found */

这是我自己的代码

    mode: 'spa',
  /*
  ** Headers of the page
  */
  server: {
    port: 8000, // default: 3000
    host: '0.0.0.0' // default: localhost
  },
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      { rel: 'stylesheet', href: 'static/css/theme/layout.css' }
    ]
  },

我也npm run dev

2 个答案:

答案 0 :(得分:0)

因此,nuxt拥有它自己的。 就您而言:

return

答案 1 :(得分:0)

对于Java语言而言

export default {
    ...
    head: {
        script: [{src: "/js/example.js"}]
    }
    ...
}