Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
チンパンジーでもわかるVue.js
Search
Fukuda Naoto
August 29, 2018
Technology
1
290
チンパンジーでもわかるVue.js
デジコン合宿
Fukuda Naoto
August 29, 2018
Tweet
Share
More Decks by Fukuda Naoto
See All by Fukuda Naoto
Git&GitHub勉強会
never9612
0
120
Other Decks in Technology
See All in Technology
Yamla: Rustでつくるリアルタイム性を追求した機械学習基盤 / Yamla: A Rust-Based Machine Learning Platform Pursuing Real-Time Capabilities
lycorptech_jp
PRO
4
170
LangSmith×Webhook連携で実現するプロンプトドリブンCI/CD
sergicalsix
1
150
Tech-Verse 2025 Keynote
lycorptech_jp
PRO
0
1.3k
高速なプロダクト開発を実現、創業期から掲げるエンタープライズアーキテクチャ
kawauso
1
160
生成AI開発案件におけるClineの業務活用事例とTips
shinya337
0
180
無意味な開発生産性の議論から抜け出すための予兆検知とお金とAI
i35_267
0
860
ハッカソン by 生成AIハッカソンvol.05
1ftseabass
PRO
0
130
250627 関西Ruby会議08 前夜祭 RejectKaigi「DJ on Ruby Ver.0.1」
msykd
PRO
2
370
Connect 100+を支える技術
kanyamaguc
0
150
Witchcraft for Memory
pocke
1
660
KubeCon + CloudNativeCon Japan 2025 に行ってきた! & containerd の新機能紹介
honahuku
0
120
Fabric + Databricks 2025.6 の最新情報ピックアップ
ryomaru0825
1
160
Featured
See All Featured
Thoughts on Productivity
jonyablonski
69
4.7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Embracing the Ebb and Flow
colly
86
4.7k
Being A Developer After 40
akosma
90
590k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
720
Why Our Code Smells
bkeepers
PRO
337
57k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Transcript
チンパンジーでもわかるVue.js
そもそもVue.jsってなんぞや
うるせ~~! 知らね~~!
これまでのWebページ .htmlファイルにHTMLを書く ↓ CSSで見た目を整える ↓ JS(またはJQuery)で動きをつけたりサーバとの通信したり
Vue.jsだと なんかJSとHTMLがうまい感じにつながってくれる (双方向バインディング)
とりあえず手を動かせ index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>
チンパンジーでもわかるVue.js</title> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js" </head> <body> <div id="app"> <p>{{ message }}</p> </div> <script src="script.js"></script> </body> </html>
script.js const app = new Vue({ el: '#app', data: {
message: 'Hello Vue!' } })
テキストボックスで双方向バインディングを 感じろ <div id="app"> <input v-model="message" /> <p>{{ message }}</p>
</div>
クリックしたときのアクション <div id="app"> <input v-model="message" /> <button v-on:click="deleteString"> 削除</button> <p>{{
message }}</p> </div> const app = new Vue({ el: '#app', data: { message: 'Hello Vue!' }, methods: { deleteString: function(){ this.message = ''; } } })
HTMLタグの属性に変数使いたくない? <div id="app"> <input v-model="message" v-bind:maxlength="maxLength"/> <button v-on:click="deleteString"> 削除</button> <progress
v-bind:max="maxLength" v-bind:value="message.length <p>{{ message }}</p> </div
data: { message: 'Hello Vue!', maxLength: 20, }
ここまでのディレクティブまとめ v‑on:イベント v‑bind:属性 v‑model 実はv‑onとv‑bindを組み合わせているだけ
Q.いちいち書くのめんどくさい A.v‑onとv‑bindは短縮記法あるで <button v-on:click="deleteString"> 削除</button> <progress v-bind:max="maxLength" v-bind:value="message.length" <button @click="deleteString">
削除</button> <progress :max="maxLength" :value="message.length"></progress>
要素の表示・非表示を操れ methods: { deleteString: function(){ this.message = ''; }, toggleVisible:
function(){ this.isVisible = !this.isVisible; } } <button @click="toggleVisible">{{ isVisible ? ' 非表示' : ' 表示' <p v-if="isVisible">{{ message }}</p>
超便利!配列を展開する <ol> <li v-for='animal in animals'>{{ animal }}</li> </ol> data:
{ message: 'Hello Vue!', maxLength: 20, animals:[' チンパンジー',' ゴリラ',' サル'] }
ディレクティブまとめ v‑if trueで要素表示、falseで要素非表示 v‑for 配列の要素 in 配列 で配列の文だけHTMLの要素が展開される
まとめ Vue.jsはいいぞ Reactもいいぞ