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
Vuexについて
Search
sinpey_g2
October 19, 2017
Technology
1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vuexについて
Vuexについて社内LTで発表したときの資料です
sinpey_g2
October 19, 2017
Other Decks in Technology
See All in Technology
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
6
4.9k
フロントエンドカンファレンス関西2026 - 速すぎるUIに、待ち時間を
teamlab
PRO
0
130
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
4
1.1k
Optunaの最新リリースv5.0について
pfn
PRO
0
120
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
250
go-sqletch
moznion
0
140
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
470
⾮構造化データを価値に変える AI エージェント基盤とその組織
ivry_presentationmaterials
0
190
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
160
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.4k
Getting Started with Google Antigravity
glaforge
0
300
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Accessibility Awareness
sabderemane
1
250
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
Google's AI Overviews - The New Search
badams
0
1.6k
Utilizing Notion as your number one productivity tool
mfonobong
4
620
Documentation Writing (for coders)
carmenintech
77
5.6k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
560
First, design no harm
axbom
PRO
2
1.3k
Transcript
Vuexʹ͍ͭͯ !TJOQFZ@H
Vuex ͱ
ग़యIUUQTWVFYWVFKTPSHKBJOUSPIUNM
Vue.jsͷͭΒ͍ͱ͜ΖΛ ղܾͯ͘͠ΕΔͷ ग़యIUUQTWVFYWVFKTPSHKBJOUSPIUNM
Vue.js ͷͭΒ͍ͱ͜Ζ
Vue.jsͷσʔλϑϩʔ ग़యIUUQTWVFYWVFKTPSHKBJOUSPIUNM
Vue.jsͷσʔλϑϩʔ ୯ҰίϯϙʔωϯτͰ͔͠௨༻͠ͳ͍ ग़యIUUQTWVFYWVFKTPSHKBJOUSPIUNM
Vue.jsͷͭΒ͍ͱ͜Ζ ίϯϙʔωϯτؒͰ ঢ়ଶͷڞ༗͕໘
Vue.jsͷͭΒ͍ͱ͜Ζ ࢠ ଙ isUpdated role index props : [
role, isUpdated ] props : [ role ] props : [ role, index, isUpdated ] props : [ role, index, isUpdated ] props : [ isUpdated ] props : [ isUpdated ] ˡΤϥʔ
Vue.jsͷͭΒ͍ͱ͜Ζ wίϯϙʔωϯτ͔Βঢ়ଶͷड͚͠ wଞίϯϙʔωϯτͰঢ়ଶΛڞ༗ ଙɺͻଙ͕૿͑ΔͱQSPQTࠈʹͳΔ ίϯϙʔωϯτͷঢ়ଶมԽΛͰXBUDIͯ͠ৗʹಉظ ͭΒ͗͢Δ
VuexΛ͏ͱ…!
VuexΛ͑͜͏ॻ͚Δ ɾશͯͷίϯϙʔωϯτʹରͯ͠ ɹঢ়ଶΛཧɺڞ༗Ͱ͖Δ ɾࢠؒͰ༨ܭͳঢ়ଶͷ ɹड͚͠Λ͠ͳͯ͘Α͘ͳΔʋ(*´∇ʆ)ů
Vue.jsͷσʔλϑϩʔ ग़యIUUQTWVFYWVFKTPSHKBJOUSPIUNM
Vuexͷσʔλϑϩʔ 'MVY 3FEVY͔ΒͷӨڹΛड͚͍ͯΔ ίϯϙʔωϯτͷ ·ͱ·Γ ग़యIUUQTWVFYWVFKTPSHKBJOUSPIUNM
Vuex جຊతͳ͍ํ
Vuex ͍ํ const store = new Vuex.Store({ state: { },
mutations: { }, actions: { } }) // State // Mutation // Action
Vuex ͍ํ State State VuexͷجຊͰ͋Γ࠷େͳཁૉ = ঢ়ଶ
state: { form: { article: { title: '', ogp_title: '',
description: '', keywords: '', main_image: '', }, writers: [], blocks: [], status: Number, should_update: Boolean }, role: String, errors: [], }, Vuex ͍ํ State
Vuex ༻ྫ Mutation Mutation StateΛมߋ͢Δ = ঢ়ଶΛมԽͤ͞Δ MutationҎ֎͕ StateΛมߋ͢Δ͜ͱͰ͖ͳ͍
mutations: { readRole (state, role) { state.role = role },
}, this.$store.commit(‘readRole', ‘staff’) Vuex ༻ྫ Mutation Mutarionͷએݴ ίϯϙʔωϯτͰMutationΛ͏
Vuex ༻ྫ Action Action ඇಉظॲཧΛߦ͏ MutationΛݺͿ StateΛมߋ͢Δ͜ͱͰ͖ͳ͍
Vuex ༻ྫ Action Action MutationͰඇಉظॲཧΛߦΘͳ͍ ඇಉظॲཧ͕ແ͍߹ActionΛ հ͞ͳͯ͘ྑ͍
actions: { saveRole: function(context) { axios.post().then( context.commit(‘saveRole’)) } } methods:
{ saveRole() { this.$store.dispatch('saveRole') } } Vuex ༻ྫ Action Actionͷએݴ ίϯϙʔωϯτ͔ΒActionͷ࣮ߦ
·ͱΊ w7VFYͱ wෳίϯϙʔωϯτͰঢ়ଶͷڞ༗Λศརʹ͢Δͷ wجຊతͳ͍ํ w4UBUF wঢ়ଶΛอ࣋ w.VUBUJPO wঢ়ଶΛมߋ͢Δ w"DUJPO wඇಉظॲཧΛߦ͏
ࢀߟ wެࣜυΩϡϝϯτ IUUQTWVFYWVFKTPSHKB w7VFKTͷίϯϙʔωϯτͱࢠؒσʔλͷૹड৴ ɹ IUUQDIJCJOPXBOFUOPUFWVFKTWVFIUNM