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
29
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
Transcript
14 slides
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 } }
おしまい
More Decks by Kaneko Takeshi
See All by Kaneko Takeshi
オープンソースライセンスについて勉強する定期
tkckaneko
0
57
Eye Tracking on the Browser
tkckaneko
0
110
IEEE754を完全に理解した
tkckaneko
1
97
CSSのトレンドをみんなで見よう -2021年-
tkckaneko
0
110
多分これが一番早いと思います
tkckaneko
0
35
暗黒面の話
tkckaneko
0
38
CSR / SSR / SSG / JAMstack
tkckaneko
0
86
BOLT
tkckaneko
0
48
CSS Logical Properties and Values
tkckaneko
0
72
Other Decks in Technology
See All in Technology
AIフレンドリーなGenerative UIをJSXで
uhyo
2
120
Kubernetes, Agones, WebRTC, GPU で作る クラウドゲーミング基盤を本番運用に乗せるまで
vivion
0
270
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
270
閉域網でのAPI公開の選択肢全部比較!
takano0131
5
700
そのイメージ、どのCIが作った? Artifact Attestationsで来歴を固定する / Which CI system created that image? Pinning provenance with Artifact Attestations
chmikata
0
270
20261119_AgentCore
takuyay0ne
2
240
統制されたID・権限をどう利用するか : DPoP/FAPIによるAPIセキュリティ強化
oidfj
2
300
攻撃と守りは何が変わり、何が変わらないのか~最近の不正アクセスから考える、リスク評価と標準の使いどころ
oidfj
2
320
gradle-best-practices 使ってみた
mikanichinose
0
230
個人ASを取得して、自宅Kubernetes上のVMをグローバルIPで公開した話
munenick
0
230
現場に渡し、構造で守る AI エージェントを活用したセルフサーブのデータ基盤の運用
legalontechnologies
PRO
0
110
その修正で本当に速くなったのか? k6とOpenTelemetryで確かめる性能改善 / Performance review with k6 and OpenTelemetry
ymotongpoo
3
440
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.8k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Bash Introduction
62gerente
615
220k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.3k
30 Presentation Tips
portentint
PRO
1
480
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
830
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.9k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.2k
Building Adaptive Systems
keathley
44
3.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k