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
Nuxt.js in TypeScript
Search
nunulk
January 17, 2019
Programming
460
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nuxt.js in TypeScript
やってみた
nunulk
January 17, 2019
More Decks by nunulk
See All by nunulk
Laravelでテストしやすいコードを書く5 / 5 tips of building testable modules in Laravel
nunulk
0
350
Design It! in a nutshell
nunulk
1
310
PHP Getting Faster
nunulk
0
290
How does learning English broaden your world?
nunulk
0
420
Testing on Laravel
nunulk
1
1.6k
Vue.js + TypeScript + Firebase
nunulk
0
970
A startup meets Laravel + Vue.js
nunulk
1
2.1k
Unit Testing Laravel
nunulk
0
520
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
610
Other Decks in Programming
See All in Programming
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
130
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
910
ソフトウェアラスタライザ
fadis
1
800
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
140
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
330
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
150
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
520
Press start. Python's next generation.
willingc
PRO
3
330
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
320
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
120
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
590
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
180
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Optimising Largest Contentful Paint
csswizardry
37
3.9k
The Language of Interfaces
destraynor
162
27k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
660
Building Applications with DynamoDB
mza
96
7.2k
Embracing the Ebb and Flow
colly
88
5.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Done Done
chrislema
186
16k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
400
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Transcript
Nuxt.js in TypeScript ͬͯΈͨ nunulk ΒΒͼΎ͏ʮͬͯΈͨʯറΓͷLTେձ
ࣗݾհ const name: Name = 'nunulk(͵͵Δ͘)' let job: Job
= 'ϑϦʔϥϯεͷΣϒΞϓϦέʔγϣϯΤϯδχΞ' let languages: Language[] = [ 'C/C++', ‘Java', 'PHP', ‘JavaScript', ‘TypeScript’, ] let frameworks: Framework[] = [ 'CodeIgniter', 'Symfony', 'CakePHP', ‘Laravel', ]
ຊ͢͜ͱ • Nuxt.js ͱ TypeScript ͷհ • Nuxt.js ͷ TypeScript
ରԠঢ়گ • Nuxt.js Λ TypeScript Ͱಈ͔ͯ͠ΈΔ
Nuxt.js, TypeScript ͷհ
Nuxt.js ͱ “Nuxt.js Vue ΞϓϦέʔγϣϯΛ࡞͢ΔϑϨʔϜϫʔ ΫͰ͢ɻϢχόʔαϧΞϓϦέʔγϣϯɺ੩తʹੜ͞Ε ΔΞϓϦέʔγϣϯɺγϯάϧϖʔδΞϓϦέʔγϣϯͷ த͔Β࡞͢ΔΞϓϦέʔγϣϯΛબͿ͜ͱ͕Ͱ͖·͢ɻ” -
͡Ίʹ - Nuxt.js
Nuxt.js ͱ “Nuxt.js Vue ΞϓϦέʔγϣϯΛ࡞͢ΔϑϨʔϜϫʔ ΫͰ͢ɻϢχόʔαϧΞϓϦέʔγϣϯɺ੩తʹੜ͞Ε ΔΞϓϦέʔγϣϯɺγϯάϧϖʔδΞϓϦέʔγϣϯͷ த͔Β࡞͢ΔΞϓϦέʔγϣϯΛબͿ͜ͱ͕Ͱ͖·͢ɻ” -
͡Ίʹ - Nuxt.js
Nuxt.js ͱ “Nuxt.js Vue ΞϓϦέʔγϣϯΛ࡞͢ΔϑϨʔϜϫʔ ΫͰ͢ɻϢχόʔαϧΞϓϦέʔγϣϯɺ੩తʹੜ͞Ε ΔΞϓϦέʔγϣϯɺγϯάϧϖʔδΞϓϦέʔγϣϯͷ த͔Β࡞͢ΔΞϓϦέʔγϣϯΛબͿ͜ͱ͕Ͱ͖·͢ɻ” -
͡Ίʹ - Nuxt.js
Nuxt.js ͱ • vue, vuex, vue-router, vue-server-renderer, vue-meta શ෦ೖΓ •
ϧʔςΟϯάͷࣗಈԽɺmiddleware • Vue ίϯϙʔωϯτͱ Vuex Store ͷ࣮ʹઐ೦ Ͱ͖Δ
TypeScript ͱ “TypeScript ϚΠΫϩιϑτʹΑͬͯ։ൃ͞Εɺϝϯςφϯε ͞Ε͍ͯΔϑϦʔͰΦʔϓϯιʔεͷϓϩάϥϛϯάݴޠͰ͋Δɻ TypeScriptJavaScriptʹରͯ͠ɺলུՄೳͳ੩తܕ͚ͱΫ ϥεϕʔεΦϒδΣΫτࢦΛՃ͑ͨݫີͳεʔύʔηοτͱͳͬ ͍ͯΔɻ” - Wikipedia
TypeScript ͱ “TypeScript ϚΠΫϩιϑτʹΑͬͯ։ൃ͞Εɺϝϯςφϯε ͞Ε͍ͯΔϑϦʔͰΦʔϓϯιʔεͷϓϩάϥϛϯάݴޠͰ͋Δɻ TypeScriptJavaScriptʹରͯ͠ɺলུՄೳͳ੩తܕ͚ͱΫ ϥεϕʔεΦϒδΣΫτࢦΛՃ͑ͨݫີͳεʔύʔηοτͱͳͬ ͍ͯΔɻ” - Wikipedia
TypeScript ͱ let t: [string, number] = ['Jan', 1] enum
Color { Red, Green, Blue } const c: Color = Color.Green interface Food { name: string calories: number } class Menu { items: string[] pages: number constructor(items: string[], pages: number) { this.items = items this.pages = pages } }
Nuxt.js ͷ TypeScript ରԠঢ়گ
Template
Packages • nuxt-property-decorator: vue-class- component ͷϥούʔ • vuex-class: vuex ؔ࿈ͷܕఆٛ
• axios: ඇಉظHTTP௨৴
Nuxt.js Λ TypeScript Ͱಈ͔ͯ͠ΈΔ
υϝΠϯͷܕͱ RootState ͷఆٛ export interface Task { title: string;
status: TaskStatus; } export enum TaskStatus { Open = 'open', Doing = 'doing', Closed = 'closed', } export interface RootState { tasks: Task[]; }
Vue, Decorator ͷ import <script lang="ts"> import { Vue,
Component, Prop } from 'nuxt-property-decorator' @Component({}) export default class extends Vue { @Prop() value: Task }
Store ͷ࣮ export const state = (): RootState => ({
tasks: [], }) export const mutations: MutationTree<RootState> = { setTasks(state: RootState, tasks: Task[]): void { state.tasks = tasks }, addTask(state: RootState, task: Task): void { state.tasks.push({...task}) }, } export const actions: ActionTree<RootState, RootState> = { async fetchTasks({ commit }) { const tasks: Task[] = await api.fetchTasks() commit("setTasks", tasks) } }