将bootstrap主题与nuxt.js项目集成

问题描述 投票:0回答:1

我刚刚开始一个新项目,并且正在与我希望与Nuxt.js项目集成的引导主题一起工作。

我相信我已经正确加载了所有CSS资产文件,尽管我试图弄清楚如何正确添加JS文件。

我曾尝试像这样在nuxt.config.js中加载脚本源文件:

export default {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  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' }
    ],
    script: [
      { src: './assets/js/jquery-1.11.0.min.js'},
      { src: './assets/bootstrap/js/bootstrap.min.js'},
      { src: './assets/js/jquery.backstretch.min.js'},
      { src: './assets/js/owl.carousel.min.js'},
      { src: './assets/js/jquery.knob.min.js'},
      { src: './assets/js/jquery.magnific-popup.min.js'},
      { src: './assets/js/jquery.simple-text-rotator.min.js'},
      { src: './assets/js/jquery.waypoints.js'},
      { src: './assets/js/wow.min.js'},
      { src: './assets/js/smoothscroll.js'},
      { src: './assets/js/jquery.fitvids.js'},
      { src: './assets/js/gmaps.js'},
      { src: './assets/js/custom.js'},
      { src: 'http://maps.google.com/maps/api/js?sensor=true'}
    ]
  },
...

而且我也曾尝试像这样直接在我的index.vue文件中添加主题:

<script>
// import Logo from '~/components/Logo.vue'

export default {
  components: {
    // Logo
  },
  head () {
    return {
      script: [
        { src: '/assets/js/jquery-1.11.0.min.js'},
        { src: '/assets/bootstrap/js/bootstrap.min.js'},
        { src: '/assets/js/jquery.backstretch.min.js'},
        { src: '/assets/js/owl.carousel.min.js'},
        { src: '/assets/js/jquery.knob.min.js'},
        { src: '/assets/js/jquery.magnific-popup.min.js'},
        { src: '/assets/js/jquery.simple-text-rotator.min.js'},
        { src: '/assets/js/jquery.waypoints.js'},
        { src: '/assets/js/wow.min.js'},
        { src: '/assets/js/smoothscroll.js'},
        { src: '/assets/js/jquery.fitvids.js'},
        { src: '/assets/js/gmaps.js'},
        { src: '/assets/js/custom.js'},
        { src: 'http://maps.google.com/maps/api/js?sensor=true'}
      ]
    }
  }
}
</script>

我尝试用~//以及./开头路径>

问题是,这些源文件找不到声明的路径。

”引导主题集成nuxr“<p非常感谢任何想法或帮助!

我刚刚开始一个新项目,并且正在与我想与Nuxt.js项目集成的引导主题一起工作。我相信我已经正确加载了所有css资产文件,尽管我是...

config nuxt.js nuxt
1个回答
1
投票

我不确定Assets文件夹是否是脚本的最佳放置位置,因为webpack将处理该文件夹。对于我的脚本,我使用static

文件夹,您只需要/
© www.soinside.com 2019 - 2024. All rights reserved.