Nuxt.jsで1ページだけ jQuery やbootstrapを使う

公式に書いてありました。。。今回はbootstrapを入れます。

pages/ ディレクトリの .vue ファイル内でリソースをインクルードします:

<template>
 <h1>About page with jQuery and Roboto font</h1>
</template>
<script>
export default {
  head() {
    return {
      script: [
        {
          src:
            "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"
        }
      ],
      link: [
        {
          rel: "stylesheet",
          href:
            "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
        }
      ]
    };
  },
</script>
<style scoped>
h1 {
 font-family: Roboto, sans-serif;
}
</style>

この記事が気に入ったらサポートをしてみませんか?