Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
NuxtJS Components/Content module
Search
Kaneko Takeshi
May 29, 2020
Technology
25
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NuxtJS Components/Content module
Pizza_jp#29
Kaneko Takeshi
May 29, 2020
More Decks by Kaneko Takeshi
See All by Kaneko Takeshi
オープンソースライセンスについて勉強する定期
tkckaneko
0
47
Eye Tracking on the Browser
tkckaneko
0
100
IEEE754を完全に理解した
tkckaneko
1
89
CSSのトレンドをみんなで見よう -2021年-
tkckaneko
0
100
多分これが一番早いと思います
tkckaneko
0
31
暗黒面の話
tkckaneko
0
31
CSR / SSR / SSG / JAMstack
tkckaneko
0
79
BOLT
tkckaneko
0
41
CSS Logical Properties and Values
tkckaneko
0
61
Other Decks in Technology
See All in Technology
AIエージェント時代のPlatform as a Product —— テックリードがPdMとして回す発見・導入・計測 / Platform as a Product in the AI Agent Era
toshi0607
0
120
Genieを崇めよ
kameitomohiro
0
170
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
33
32k
Harness Engineering on Rails
joelq
0
460
ScotSecure West 2026 - Glasgow
raybugg
0
160
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
32
21k
beyond jj: config & tools ecosystem
indirect
0
6k
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
520
手を動かして実感する、Kiro が変える開発体験
inariku
0
270
人にやさしく、AIにやさしく、書き手を選ばないIaCのガードレール再考 / Rethinking IaC Guardrails for Humans and AI Alike
kohbis
5
940
CLIライブラリ開発を支える技術
htnabe
0
150
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.7k
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
550
Navigating Team Friction
lara
192
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
250
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
590
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
420
Mobile First: as difficult as doing things right
swwweet
225
10k
The Curious Case for Waylosing
cassininazir
1
540
Transcript
NuxtJS Components/Content module
Components module 自動でコンポーネントを探してきてインポートしてくれるモジュール import文とcomponentsフィールドを書かなくてよくなる 便利すぎるので試してみた話です
Components module $ yarn create nuxt-app playground-202005 $ yarn add
--dev @nuxt/components で、簡単に入れられます。
Components module 現在(2020/05/29)の最新版バージョン2.12.2の場合 nuxt.config.jsを書き換える ※ 2.13.xからは不要になる buildModules: [ '@nuxt/components', ],
Components module <script lang="ts"> import Vue from 'vue' import Logo
from '~/components/Logo.vue' export default Vue.extend({ components: { Logo } }) </script> これが
Components module <script lang="ts"> import Vue from 'vue' </script> こうなる
Components module $ yarn dev 実行!
べんり!
Content module MarkdownとかJSONなんかからNuxtJSへ渡してくれるモジュール なんかいろいろできる - 全文検索とかできる - Markdownの構文もVueのコンポーネントで書き出せる - 目次もつくれる
スゴそうなので試してみた話です
Content module $ yarn add @nuxt/content ※ さっきのに追加 nuxt.config.jsを書き換える modules:
[ '@nuxt/content', ],
Content module 下準備は簡単 contentディレクトリをつくってmdファイルを入れるだけ ├─- content │ └── articles │
├── article-1.md │ └── article-2.md
Content module 一覧を取得する - $contentでディレクトリのパスをセット - チェーンシーケンスが返ってくる - sortByとかsearchとか繋げられる async
asyncData ({ $content, params }) { const query = await $content('articles').limit(15) const articles = await query.fetch() return { articles } }
Content module コンテンツを取得する - $contentでファイルのパスをセット - <nuxt-content>テンプレートでページの本文を表示 async asyncData ({
$content, params }) { const articles = await $content('articles', params.slug).fetch() return { articles } }
おしまい