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
27
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
51
Eye Tracking on the Browser
tkckaneko
0
100
IEEE754を完全に理解した
tkckaneko
1
92
CSSのトレンドをみんなで見よう -2021年-
tkckaneko
0
100
多分これが一番早いと思います
tkckaneko
0
34
暗黒面の話
tkckaneko
0
33
CSR / SSR / SSG / JAMstack
tkckaneko
0
82
BOLT
tkckaneko
0
46
CSS Logical Properties and Values
tkckaneko
0
68
Other Decks in Technology
See All in Technology
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
150
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
440
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
130
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
350
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
190
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
160
会社説明資料
persolserverworks
0
9.8k
継続的なAIコスト最適化
bgpat
1
340
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.3k
その Valkey 使いこなしていますか?
onk
PRO
5
1.5k
Benchmarking Disaggregated Serving on vLLM + Dynamo with a Real Coding-Agent Workload
nttcom
1
190
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
Test your architecture with Archunit
thirion
2
2.4k
Embracing the Ebb and Flow
colly
88
5.2k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
Mobile First: as difficult as doing things right
swwweet
225
10k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
780
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
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 } }
おしまい