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
初めてのVue.js で PWA の ビンゴゲームを作った話
Search
AZKZ
September 04, 2020
Programming
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
初めてのVue.js で PWA の ビンゴゲームを作った話
AZKZ
September 04, 2020
Transcript
17 slides
5 週間で Web サービスをリリース⼈集まれ@新宿もくもく会 初めてのVue.js で PWA の ビンゴゲームを作った話 1
⾃⼰紹介 名前︓あぜがみ 年齢︓25歳 仕事︓中⼩SES企業(保守運⽤、開発はほぼ経験無し) ⾔語︓JavaとKotlinをほんの少し 2
参加の動機 フロントエンドの技術を使って、何か作りたかった。 前回のこの企画のLTを聞いてみて、皆さん楽しそうだった。 作るなら公開した⽅が絶対いいよな... コロナ禍で時間もあるし参加しちゃえ︕ 3
技術スタック フロントエンド Vue.js Vuetify(CSSフレームワーク) Vue Router(URLルーティング) idb(indexdDBの便利ライブラリ、おすすめ) など バックエンド
無し インフラ Github Pages 無料 かつ HTTPSなので静的Webページの公開には⾮常におすすめ。 でも、若⼲ハマったので後述します。 4
機能説明 デモ https://azkz.github.io/bingo/ 5
解決できる課題 ビンゴカードの購⼊ ビンゴカードの配布、⽚付け 数字を抽選する仕組みの準備 抽選された数字の記録 これらの作業で発⽣するコスト・⼿間を排除できる︕ 6
さらに、 アプリ・会員登録不要 通信状況の影響を受けない(PWA) オンラインでも楽しめる ⼈数制限無し 完全無料 7
PWAって︖ Progressive Web Apps のこと Webアプリがスマホアプリのように使える オフラインでも動く プッシュ通知を受け取れる しかも、 アプリストアを通さなくてもよい︕
Webの技術だけでOK︕ 8
今回作ったビンゴゲームでも インストールできる 9
若⼲⾒た⽬がネイティブアプリっぽくなる オフラインでも使える 10
良かった点 想像以上にSPAを簡単に楽しく作ることができた。 他のReactやAngularは触ったことないが、Vueは噂通り⼿軽だと感じた。 サービスとしてリリースできた達成感を感じられた。 ⾃分で思い描いていたものを形にできた。 (需要があるかはさておき)サービスによって解決できる課題がある。 ⼀応、PWAにすることもできた。 Vue CLIでプロジェクト作成時に選択しただけ、驚くほど簡単。 (実際、PWAである必要性は感じていない。)
11
反省する点 ほとんどコンポーネント化していない。 1 画⾯ 1 ファイルの状態。 拡張性が低い。 変更が難しい。 テストコードが無い。 ⼿を加えたいとは思えない。
Vueの基礎を抑えられていない。 動けば良しのところがたくさん。 状態管理とかわかってない。 12
まとめ 初めての技術でもググれば、動くモノ⾃体は作れると改めて実感。 しかし、品質の⾼いコードを書くには、設計⼿法を学び、 それを⽣かして、もっとコードを書く必要がある。 13
ハマったポイント 事象︓URLから参加できるようにしたが、404になってしまう 本来はサーバーの設定で解決するらしい (公式ドキュメント) →でも、Github Pagesだからサーバーとかない... 14
解決策 1. ⾃前で404.htmlを⽤意 2. sessionStorageにアクセスしたパスとパラメータを格納 3. ルートパスにリダイレクトさせる 404.html <!DOCTYPE html>
<html lang="en"> <head> <script> // URL直打ち時に404画⾯を出さないために // sessionStorageにパスとパラメーターを保存して // ルートパスにリダイレクトする sessionStorage.redirectPathname = location.pathname sessionStorage.redirectParamater = location.search </script> <meta http-equiv="refresh" content="0;URL=./"></meta> </head> </html> 15
4. App.vueのcreatedフックでsessionStorageの中⾝を取り出す 5. Vue Routerを使って、遷移させる App.vue <script> export default {
name: 'App', created: function () { // 404.htmlで保管された値を取得する const redirectPathname = sessionStorage.redirectPathname const redirectParamater = sessionStorage.redirectParamater console.log('redirectPathname:' + redirectPathname) console.log('redirectParamater:' + redirectPathname) // 取得できたため、削除する delete sessionStorage.redirectPathname delete sessionStorage.redirectParamater // URL直打ちリダイレクトされているようなら、そのパスにvue-routerで遷移する if (redirectPathname && redirectPathname !== location.pathname) { const pushPath = redirectPathname.replace(process.env.BASE_URL, '/') + redirectParamater console.log('pushPath:' + pushPath) this.$router.push(pushPath) } } } </script> 16
終わり ありがとうございました︕ 17
Other Decks in Programming
See All in Programming
Debian JP Projectのサーバー構成
uwabami
1
190
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
340
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
3
240
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
210
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
1.2k
小さなアプリを作って公開するまで
onozaty
0
260
はじめてのKubernetesコントリビューション
nasa9084
0
330
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
230
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
670
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
130
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
410
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
エンジニアに許された特別な時間の終わり
watany
109
250k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Accessibility Awareness
sabderemane
1
310
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Making the Leap to Tech Lead
cromwellryan
135
10k
Leo the Paperboy
mayatellez
11
2.5k