{"id":6332,"date":"2020-03-25T15:00:51","date_gmt":"2020-03-25T06:00:51","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=6332"},"modified":"2020-03-25T04:54:45","modified_gmt":"2020-03-24T19:54:45","slug":"firebase-vue%e3%81%a7%e3%83%81%e3%83%a3%e3%83%83%e3%83%88%e3%82%92%e3%81%a4%e3%81%8f%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=6332","title":{"rendered":"Firebase + Vue\u3067\u30c1\u30e3\u30c3\u30c8\u3092\u3064\u304f\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u300c<a href=\"https:\/\/blog.capilano-fw.com\/?p=6294\">Firebase + Vue\u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u308b<\/a>\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3067\u306f<code>Firebase<\/code>\u3092\u4f7f\u3063\u305f\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001<code>Authentication<\/code>\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3063\u305f\u3082\u306e\u3067\u3059\u304c\u3001\u5b9f\u306f\u4ed6\u306b\u3082\u30b5\u30fc\u30d3\u30b9\u304c\u3042\u308b\u306e\u3067\u3001\u3082\u3046\u5c11\u3057\u6df1\u5800\u308a\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u7d39\u4ecb\u3059\u308b\u5185\u5bb9\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">Firebase\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u6a5f\u80fd<\/strong><strong style=\"font-size: 35px;\">\u300cFirestore\u300d<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p><code>Firestore<\/code>\u306f\u3001<code>MySQL<\/code>\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u7ba1\u7406\u3092\u30af\u30e9\u30a6\u30c9\u4e0a\u3067\u5b9f\u73fe\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u3053\u306e\u6a5f\u80fd\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u30c1\u30e3\u30c3\u30c8\u3092\u3064\u304f\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3405 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png 310w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18-291x300.png 291w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/p>\n<p>\u958b\u767a\u74b0\u5883\uff1a Firebase JavaScript SDK 7.12.0<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u308b\u30e6\u30fc\u30b6\u30fc\u3060\u3051\u304c\u30c1\u30e3\u30c3\u30c8\u306b\u53c2\u52a0\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br \/>\n<span style=\"font-size: 1rem;\">\u307e\u305f\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u5185\u5bb9\u306f\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u66f4\u65b0\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/span><\/p>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u307e\u305a<code>Firebase<\/code>\u3067\u30ed\u30b0\u30a4\u30f3\u304c\u3067\u304d\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/blog.capilano-fw.com\/?p=6294\" target=\"_blank\" rel=\"noopener noreferrer\">\u524d\u56de\u8a18\u4e8b<\/a>\u3092\u53c2\u8003\u306b\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u306a\u304a\u3001\u30c6\u30b9\u30c8\u3067\u4f7f\u3046\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u306f\uff12\u4eba\u4f5c\u3063\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>Firebase\u306e\u6e96\u5099<\/h1>\n<h2>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u3064\u304f\u308b<\/h2>\n<p>\u3067\u306f\u3001<code>Firebase<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u30e1\u30cb\u30e5\u30fc\u306e\u300c<strong>Database<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001\u300c<strong>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u958b\u59cb<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6343\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_1.png\" alt=\"\" width=\"633\" height=\"317\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_1.png 633w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_1-300x150.png 300w\" sizes=\"auto, (max-width: 633px) 100vw, 633px\" \/><\/p>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306eID\u3092\u5165\u529b\u3057\u3066\u300c<strong>\u6b21\u3078<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<br \/>\n\uff08\u4eca\u56de\u306f<code>chats<\/code>\u306b\u3057\u307e\u3059\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6342\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_2.png\" alt=\"\" width=\"640\" height=\"351\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_2.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_2-300x165.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u6b21\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\uff13\u3064\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6338\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_6.png\" alt=\"\" width=\"640\" height=\"601\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_6.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_6-300x282.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u4e2d\u8eab\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>message\u3000\u30fb\u30fb\u30fb\u3000\u30c1\u30e3\u30c3\u30c8\u306e\u30e1\u30c3\u30bb\u30fc\u30b8<\/li>\n<li>created\u3000\u30fb\u30fb\u30fb\u3000\u4f5c\u6210\u65e5\u6642\uff08\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\uff09<\/li>\n<li>uid\u3000\u30fb\u30fb\u30fb\u3000\u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306eID<\/li>\n<\/ul>\n<p>\u306a\u304a\u3001\u672c\u6765\u30c1\u30e3\u30c3\u30c8\u306f\u540d\u524d\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\u3079\u304d\u3067\u3059\u304c\u3001\u8907\u96d1\u306b\u306a\u308b\u306e\u3067\u4eca\u56de\u306f<code>uid<\/code>\u3060\u3051\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u300c<strong>\u4fdd\u5b58<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h2>\u6a29\u9650\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n<p>\u5148\u307b\u3069\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u3064\u304f\u308a\u307e\u3057\u305f\u304c\u3001\u5b9f\u306f\u3053\u306e\u307e\u307e\u3067\u306f\u5916\u90e8\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002\u306a\u305c\u306a\u3089\u6a29\u9650\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3089\u3067\u3059\u3002<\/p>\n<p><code>Firestore<\/code>\u3067\u306f\u6a29\u9650\u306f\u300c<strong>\u30eb\u30fc\u30eb<\/strong>\u300d\u3067\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\u753b\u9762\u4e0a\u90e8\u306e\u300c\u30eb\u30fc\u30eb\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6339\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_5.png\" alt=\"\" width=\"385\" height=\"117\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_5.png 385w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_5-300x91.png 300w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u6a29\u9650\u306e\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>rules_version = '2';\r\nservice cloud.firestore {\r\n  match \/databases\/{database}\/documents {\r\n    <strong>match \/chats\/{chatId} {\r\n      allow read, create: if request.auth.uid != null;\r\n    }<\/strong>\r\n  }\r\n}<\/pre>\n<p>\u610f\u5473\u3068\u3057\u3066\u306f\u3001\u300c<strong>chats\u306f\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u4eba\u3060\u3051\u8aad\u307f\u66f8\u304dOK\ud83d\udc4c<\/strong>\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6a29\u9650\u306e\u8a2d\u5b9a\u3082\u3053\u308c\u3067\u5b8c\u4e86\u3067\u3059\uff01<\/p>\n<h1>HTML\u30d5\u30a1\u30a4\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u306f\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304f\u90e8\u5206\u3067\u3059\u3002<br \/>\n\u524d\u56de\u3068\u540c\u3058\u304fHTML\u30d5\u30a1\u30a4\u30eb\u3067OK\u3067\u3059\u3002<\/p>\n<p><strong><code>chat.html<\/code><\/strong><\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/css\/bootstrap.min.css\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div id=\"app\" class=\"container pt-5\"&gt;\r\n        &lt;div class=\"row\"&gt;\r\n            &lt;div class=\"col-md-4\"&gt;\r\n                &lt;div class=\"input-group\"&gt;\r\n                    &lt;input type=\"text\" class=\"form-control\" v-model=\"message\"&gt;\r\n                    &lt;div class=\"input-group-append\"&gt;\r\n                        &lt;button class=\"btn btn-primary\" @click=\"addChat\"&gt;\u9001\u4fe1&lt;\/button&gt;\r\n                    &lt;\/div&gt;\r\n                &lt;\/div&gt;\r\n                &lt;div class=\"bg-light p-3 my-2\" v-if=\"chat.message\" v-for=\"chat in chats\"&gt;\r\n                    &lt;div v-text=\"chat.message\"&gt;&lt;\/div&gt;\r\n                    &lt;small v-text=\"chat.uid\"&gt;&lt;\/small&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    &lt;script src=\"https:\/\/www.gstatic.com\/firebasejs\/7.12.0\/firebase-app.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/www.gstatic.com\/firebasejs\/7.12.0\/firebase-auth.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/www.gstatic.com\/firebasejs\/7.12.0\/firebase-firestore.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue\/dist\/vue.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script&gt;\r\n\r\n        new Vue({\r\n            el: '#app',\r\n            data: {\r\n                message: '',\r\n                chats: [],\r\n                db: null\r\n            },\r\n            methods: {\r\n                getChats() {\r\n\r\n                    \/\/ \u30c1\u30e3\u30c3\u30c8\u30c7\u30fc\u30bf\u3092\u53d6\u5f97 \u30fb\u30fb\u30fb \u2463<strong>\r\n                    this.db.collection('chats')\r\n                        .orderBy('created', 'desc') \/\/ \u6700\u65b0\u306e\u3082\u306e\u304b\u3089\u53d6\u5f97\r\n                        .limit(25)  \/\/ \u6700\u592725\u4ef6\u307e\u3067\r\n                        .get()\r\n                        .then(querySnapshot =&gt; {\r\n\r\n                            let chats = [];\r\n                            querySnapshot.forEach(doc =&gt; {\r\n\r\n                                const data = doc.data();\r\n                                chats.push({\r\n                                    uid: data.uid,\r\n                                    message: data.message\r\n                                });\r\n\r\n                            });\r\n                            this.chats = chats;\r\n\r\n                        })\r\n                        .catch(error =&gt; {\r\n\r\n                            console.log(error);\r\n\r\n                        });\r\n<\/strong>\r\n                },\r\n                addChat() {\r\n\r\n                    if(this.message === '') {\r\n\r\n                        alert('\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002');\r\n                        return;\r\n\r\n                    }\r\n\r\n                    \/\/ Firebase\u306b\u4fdd\u5b58 \u30fb\u30fb\u30fb \u2462\r\n                    <strong>this.db.collection('chats')\r\n                        .add({\r\n                            message: this.message,\r\n                            uid: firebase.auth().currentUser.uid,  \/\/ \u30e6\u30fc\u30b6\u30fcID\r\n                            created: firebase.firestore.FieldValue.serverTimestamp()\r\n                        })\r\n                        .then(docRef =&gt; {\r\n\r\n                            \/\/ const createdId = docRef.id;\r\n                            this.message = '';\r\n\r\n                        })\r\n                        .catch(error =&gt; {\r\n\r\n                            console.error('Error adding document: ', error);\r\n\r\n                        });<\/strong>\r\n\r\n                }\r\n            },\r\n            mounted() {\r\n\r\n                \/\/ Firebase\u306e\u6e96\u5099 \u30fb\u30fb\u30fb \u2460\r\n                <strong>const firebaseConfig = {\r\n                    apiKey: \"**************************\",\r\n                    authDomain: \"**************************\",\r\n                    databaseURL: \"**************************\",\r\n                    projectId: \"**************************\",\r\n                    storageBucket: \"**************************\",\r\n                    messagingSenderId: \"**************************\",\r\n                    appId: \"**************************\"\r\n                }; <\/strong>\r\n                firebase.initializeApp(firebaseConfig);\r\n                this.db = firebase.firestore();\r\n                \r\n                \/\/ \u5185\u5bb9\u306b\u5909\u66f4\u304c\u3042\u3063\u305f\u3089\u5b9f\u884c\u3055\u308c\u308b \u30fb\u30fb\u30fb \u2461\r\n                <strong>this.db.collection('chats')\r\n                    .onSnapshot(() =&gt; {\r\n\r\n                        this.getChats();\r\n\r\n                    });<\/strong>\r\n\r\n            }\r\n        });\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3067\u306f\u3001\u756a\u53f7\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\u2460 Firebase\u306e\u6e96\u5099<\/strong><\/p>\n<p><code>firebaseConfig<\/code>\u306f\u3001<a href=\"https:\/\/blog.capilano-fw.com\/?p=6294\">\u524d\u56de\u8a18\u4e8b<\/a>\u3067\u53d6\u5f97\u3057\u305f\u3082\u306e\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u3064\u307e\u308a\u3001\u74b0\u5883\u306b\u3088\u3063\u3066\u4e2d\u8eab\u304c\u9055\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u2461 \u5185\u5bb9\u306b\u5909\u66f4\u304c\u3042\u3063\u305f\u3089\u5b9f\u884c\u3055\u308c\u308b<\/strong><\/p>\n<p><code>onSnapshot()<\/code>\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5909\u66f4\u304c\u3042\u3063\u305f\u3089\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001\u91cd\u8981\u306a\u306e\u306f\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f<strong>\u81ea\u5206\u4ee5\u5916\u306e\u4eba\u304c\u5909\u66f4\u3057\u3066\u3082\u8d77\u52d5\u3055\u308c\u308b<\/strong>\u3068\u3044\u3046\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u4eca\u56de\u3067\u8a00\u3046\u3068\u300c<strong>\u81ea\u5206\u4ee5\u5916\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u6295\u7a3f\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3082\u3001\u30c1\u30e3\u30c3\u30c8\u5185\u5bb9\u304c\u6700\u65b0\u306e\u3082\u306e\u306b\u306a\u308b<\/strong>\u300d\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u2462 Firebase\u306b\u4fdd\u5b58<\/strong><\/p>\n<p>\u4fdd\u5b58\u3059\u308b\u30c7\u30fc\u30bf\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>message\u3000\u30fb\u30fb\u30fb\u3000\u5165\u529b\u3057\u305f\u5185\u5bb9<\/li>\n<li>uid\u3000\u30fb\u30fb\u30fb\u3000\u73fe\u5728\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u4eba\u306euid<\/li>\n<li>created\u3000\u30fb\u30fb\u30fb\u3000\u73fe\u5728\u6642\u9593<\/li>\n<\/ul>\n<p><strong>\u2463 \u30c1\u30e3\u30c3\u30c8\u30c7\u30fc\u30bf\u3092\u53d6\u5f97<\/strong><\/p>\n<p>\u6295\u7a3f\u3055\u308c\u305f\u30c1\u30e3\u30c3\u30c8\u30c7\u30fc\u30bf\u306f\u3001\u300c<strong>\u6700\u65b0\u306e\u3082\u306e\u304b\u3089\u6700\u592725\u4ef6<\/strong>\u300d\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u3001\u53d6\u5f97\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306f<code>chats<\/code>\u306b\u683c\u7d0d\u3055\u308c<code>Vue<\/code>\u3067\u63cf\u753b\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>\uff12\u4eba\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u5fc5\u8981\u306a\u306e\u3067<code>Google Chrome<\/code>\u306e\u901a\u5e38\u306e\u30bf\u30d6\u3068\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30fb\u30e2\u30fc\u30c9\u306e\u30bf\u30d6\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u4e0b\u5074\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u300c\u30c6\u30b9\u30c8\u9001\u4fe1\uff11\u300d\u3068\u6295\u7a3f\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6337\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_7.png\" alt=\"\" width=\"395\" height=\"460\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_7.png 395w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_7-258x300.png 258w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u81ea\u52d5\u7684\u306b\u4e21\u65b9\u306e\u30d6\u30e9\u30a6\u30b6\u306b\u305d\u306e\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6336\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_8.png\" alt=\"\" width=\"395\" height=\"436\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_8.png 395w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_8-272x300.png 272w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/p>\n<p>\u3067\u306f\u4eca\u5ea6\u306f\u9006\u306b\u3001\u4e0a\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u300c\u30c6\u30b9\u30c8\u9001\u4fe1\uff12\u300d\u3068\u9001\u4fe1\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6335\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_9.png\" alt=\"\" width=\"404\" height=\"649\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_9.png 404w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_9-187x300.png 187w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u4eca\u56de\u3082\u4e21\u65b9\u306e\u30d6\u30e9\u30a6\u30b6\u304c\u66f4\u65b0\u3055\u308c\u65b0\u3057\u3044\u9806\u306b\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6334\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_10.png\" alt=\"\" width=\"387\" height=\"609\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_10.png 387w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/firebase_chat_10-191x300.png 191w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Firestore<\/code>\u3092\u4f7f\u3063\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30fb\u30c1\u30e3\u30c3\u30c8\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u4eca\u56de\u306e\u958b\u767a\u3067\u5c11\u3057\u6b8b\u5ff5\u3060\u3063\u305f\u306e\u304c<code>Firestore<\/code>\u306f\u6295\u7a3f\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306e\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\uff08\u3064\u307e\u308a\u3001\u5404\u30c7\u30fc\u30bf\u306b\u540d\u524d\u3084<code>uid<\/code>\u3092\u767b\u9332\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff09<\/p>\n<p>\u307e\u305f\u3001<code>Firestore<\/code>\u306eID\u306f\u756a\u53f7\u3067\u306f\u306a\u304f\u30e9\u30f3\u30c0\u30e0\u306a\u6587\u5b57\u5217\u306a\u305f\u3081\u3001\u65b0\u7740\u9806\u3067\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u81ea\u524d\u3067\u6295\u7a3f\u65e5\u6642\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u70b9\u3082\u5c11\u3057\u4e0d\u4fbf\u3067\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u91cf\u3067\u30c1\u30e3\u30c3\u30c8\u6a5f\u80fd\u3092\u4f5c\u308c\u308b\u306e\u306f\u3068\u3066\u3082\u9b45\u529b\u306a\u306e\u3067\u3001\u3053\u306e\u3042\u305f\u308a\u306e\u554f\u984c\u70b9\u304c\u6539\u5584\u3067\u304d\u308c\u3070\u3001\u3082\u3063\u3068<code>Firebase<\/code>\u306f\u4f7f\u3044\u3084\u3059\u3044\u3082\u306e\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\ud83d\ude0a\u2728<\/p>\n<p>\u305c\u3072\u3001\u7686\u3055\u3093\u3082\u4e00\u5ea6\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u300cFirebase + Vue\u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u308b\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3067\u306fFirebase\u3092\u4f7f\u3063\u305f\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u3053\u308c\u306f\u3001Authen &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=6332\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Firebase + Vue\u3067\u30c1\u30e3\u30c3\u30c8\u3092\u3064\u304f\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":6349,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[207,206,91],"class_list":["post-6332","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-firebase","tag-206","tag-91"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6332"}],"version-history":[{"count":6,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6332\/revisions"}],"predecessor-version":[{"id":6348,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6332\/revisions\/6348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/6349"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}