{"id":6083,"date":"2018-07-22T14:41:20","date_gmt":"2018-07-22T05:41:20","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=6083"},"modified":"2023-05-28T00:01:46","modified_gmt":"2023-05-27T15:01:46","slug":"%e3%80%90vue-js%e3%80%91%e3%80%8c%e3%83%a9%e3%82%a4%e3%83%95%e3%82%b5%e3%82%a4%e3%82%af%e3%83%ab%e3%80%8d%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=6083","title":{"rendered":"\u3010Vue.js\u3011\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u300c\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u300d\u3001Vue\u30af\u30e9\u30b9\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p>Vue.js\u3067\u306f\u300cnew Vue\u300d\u3084\u300cVue.component\u300d\u7b49\u306e\u69cb\u6587\u306b\u3088\u3063\u3066\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u6210\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u3092\u305f\u3069\u308a\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6087\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/07\/\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306e\u6982\u8981\u56f3.png\" alt=\"\" width=\"1215\" height=\"617\" srcset=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/07\/\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306e\u6982\u8981\u56f3.png 1215w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/07\/\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306e\u6982\u8981\u56f3-300x152.png 300w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/07\/\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306e\u6982\u8981\u56f3-768x390.png 768w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/07\/\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306e\u6982\u8981\u56f3-1024x520.png 1024w\" sizes=\"(max-width: 1215px) 100vw, 1215px\" \/><\/p>\n<p><span style=\"font-size: 8pt; color: #999999;\">\u53c2\u8003\uff1ahttps:\/\/jp.vuejs.org\/v2\/guide\/instance.html#%E3%83%A9%E3%82%A4%E3%83%95%E3%82%B5%E3%82%A4%E3%82%AF%E3%83%AB%E3%83%80%E3%82%A4%E3%82%A2%E3%82%B0%E3%83%A9%E3%83%A0<\/span><\/p>\n<h2>\u305d\u3082\u305d\u3082\u300c\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u300d\u3068\u306f\uff1f<\/h2>\n<p>Vue.js\u3067\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\uff09\u304c\u51fa\u6765\u3066\u304b\u3089\u3001\u7d42\u4e86\u3059\u308b\u307e\u3067\u306e\u30c7\u30fc\u30bf\u306e\u6d41\u308c\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>beforeCreate<\/td>\n<td>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u751f\u6210\u3055\u308c\u3066\u3001\u30ea\u30a2\u30af\u30c6\u30a3\u30d6\u30c7\u30fc\u30bf\u304c\u521d\u671f\u5316\u3055\u308c\u308b\u524d<\/td>\n<\/tr>\n<tr>\n<td>created<\/td>\n<td>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u751f\u6210\u3055\u308c\u3066\u3001\u30ea\u30a2\u30af\u30c6\u30a3\u30d6\u30c7\u30fc\u30bf\u304c\u521d\u671f\u5316\u3055\u308c\u305f\u5f8c\u3002<span style=\"color: #ff0000;\"><strong>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u81ea\u8eab\u3092\u6307\u3059this\u3078\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/strong><\/span>\u4ed6\u306b\u306f\u3001Vuex\u3092\u5c0e\u5165\u3057\u3066\u3044\u306a\u3044\u5c0f\u898f\u6a21\u30a2\u30d7\u30ea\u306b\u304a\u3044\u3066Web API\u3068\u901a\u4fe1\u3057\u3066\u30c7\u30fc\u30bf\u306b\u95a2\u3059\u308b\u51e6\u7406\u3092\u958b\u59cb\u3057\u305f\u308a\u3001setInterval\u3084setTimeout\u3067\u7e70\u308a\u8fd4\u3057\u5b9f\u884c\u3059\u308b\u30bf\u30a4\u30de\u30fc\u51e6\u7406\u306e\u958b\u59cb\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u3082\u5229\u7528\u3055\u308c\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>beforeMount<\/td>\n<td>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092<span style=\"color: #ff0000;\"><strong>DOM\u306b\u30de\u30a6\u30f3\u30c8\u3055\u308c\u308b\u524d\u3001<\/strong><strong>DOM\u304c\u69cb\u7bc9\u3055\u308c\u308b\u524d<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>mounted<\/td>\n<td>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092<span style=\"color: #ff0000;\"><strong>DOM\u306b\u30de\u30a6\u30f3\u30c8\u3055\u308c\u305f\u5f8c\u3001<\/strong><strong>DOM\u304c\u69cb\u7bc9\u3055\u308c\u305f\u5f8c<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002$el\u30d7\u30ed\u30d1\u30c6\u30a3\u3084DOM API\u7b49\u306eDOM\u64cd\u4f5c\u3084\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u767b\u9332\u7b49\u304c\u884c\u3044\u305f\u3044\u5834\u5408\u306f\u3053\u306e\u30d5\u30c3\u30af\u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>beforeUpdate<\/td>\n<td>\u30c7\u30fc\u30bf\u304c\u5909\u66f4\u3055\u308c\u3066\u3001DOM\u306b\u9069\u7528\u3055\u308c\u308b\u524d<\/td>\n<\/tr>\n<tr>\n<td>updated<\/td>\n<td>\u30c7\u30fc\u30bf\u304c\u5909\u66f4\u3055\u308c\u3066\u3001DOM\u306b\u9069\u7528\u3055\u308c\u305f\u5f8c<\/td>\n<\/tr>\n<tr>\n<td>beforeDestroy<\/td>\n<td>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u7834\u68c4\u3055\u308c\u308b\u524d\u3001<span style=\"color: #ff0000;\"><strong>\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u306e\u7834\u68c4\u3001\u30bf\u30a4\u30de\u30fc\u51e6\u7406\u306e\u30af\u30ea\u30a2\u306e\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u4f7f\u308f\u308c\u307e\u3059\u3002<\/strong><\/span>\u3082\u3057\u9069\u5207\u306b\u884c\u308f\u306a\u3044\u3068\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u306e\u539f\u56e0\u306b\u306a\u308b\u306e\u3067\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/td>\n<\/tr>\n<tr>\n<td>destroyed<\/td>\n<td>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u7834\u68c4\u3055\u308c\u305f\u5f8c<\/td>\n<\/tr>\n<tr>\n<td>errorCaptured<\/td>\n<td>\u4efb\u610f\u306e\u5b50\u5b6b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304b\u3089\u30a8\u30e9\u30fc\u304c\u88dc\u8db3\u3055\u308c\u305f\u6642<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3068\u306f\uff1f<\/h3>\n<p>\u300cnew Vue\u300d\u306b\u3066\u4f5c\u6210\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<h3>DOM\u3068\u306f\uff1f<\/h3>\n<p>HTML\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306eAPI\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>Vue.js\u3067\u8a00\u3048\u3070\u3001<span style=\"color: #ff0000;\"><strong>el\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u3057\u305f\u8981\u7d20\u306e\u3053\u3068<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u300c$el\u5909\u6570\u300d\u3084\u300cgetElementById()\u300d<\/strong><\/span>\u306b\u3066DOM\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>Vue\u30af\u30e9\u30b9\u306e\u5f79\u5272<\/h2>\n<p>\u300cVue.js\u300d\u306e\u30b3\u30a2\u30af\u30e9\u30b9\u3068\u3057\u3066\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300cVue\u30af\u30e9\u30b9\u300d<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u306e\u5f79\u5272<\/h3>\n<p>Vue.js\u306eAPI\u3092\u675f\u306d\u308b\u540d\u524d\u7a7a\u9593\u3068\u3057\u3066\u306e\u5f79\u5272<\/p>\n<h3>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3068\u3057\u3066\u306e\u5f79\u5272<\/h3>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">new Vue({\u52d5\u4f5c\u30aa\u30d7\u30b7\u30e7\u30f3:\u5024})<\/pre>\n<h2>Vue\u30af\u30e9\u30b9\u3092\u4f5c\u308b\u5bfe\u8c61<\/h2>\n<p>\u57fa\u672c\u7684\u306b\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u300d\u7b49<\/strong><\/span>\u3001\u64cd\u4f5c\u3057\u305f\u3044\u5bfe\u8c61\u306b\u5bfe\u3057\u3066\uff11\u3064Vue\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<h2>\u52d5\u4f5c\u30aa\u30d7\u30b7\u30e7\u30f3<\/h2>\n<table>\n<tbody>\n<tr>\n<th width=\"100\">\u30aa\u30d7\u30b7\u30e7\u30f3<\/th>\n<th width=\"100\">\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>el<\/td>\n<td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u3069\u306eHTML\u306b\u7d50\u3073\u3064\u3051\u308b\u304b\u5b9a\u7fa9\u3057\u307e\u3059\u3002Vue.js\u3092\u6709\u52b9\u5316\u3055\u305b\u308b\u30bb\u30ec\u30af\u30bf\u3067\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>data<\/td>\n<td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u6301\u3064\u30c7\u30fc\u30bf\u3067\u3059\u3002\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3001\u914d\u5217\u3082\u767b\u9332\u3067\u304d\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>filters<\/td>\n<td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u6301\u3064\u30d5\u30a3\u30eb\u30bf<\/td>\n<\/tr>\n<tr>\n<td>computed<\/td>\n<td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u6301\u3064\u7b97\u51fa\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u3059\u3002\u51e6\u7406\u3057\u305f\u7d50\u679c\u3092\u30c7\u30fc\u30bf\u3068\u3057\u3066\u8fd4\u3057\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>methods<\/td>\n<td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u4f7f\u7528\u3059\u308b\u30e1\u30bd\u30c3\u30c9<\/td>\n<\/tr>\n<tr>\n<td>watch<\/td>\n<td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u6301\u3064\u30a6\u30a9\u30c3\u30c1\u30e3<\/td>\n<\/tr>\n<tr>\n<td>template<\/td>\n<td>\u305d\u306e\u307e\u307e\u30bf\u30b0\u3054\u3068HTML\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4e2d\u306b\u6d41\u3057\u8fbc\u3080\u4e8b\u304c\u53ef\u80fd\u3067\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u57fa\u672c\u306f\u4f7f\u308f\u306a\u3044\u3002<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td>\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30d5\u30c3\u30af<\/td>\n<td>\u6c7a\u307e\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u51e6\u7406\u3092\u5272\u308a\u632f\u3089\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5074\uff08HTML)\u300d\u3067\u3001\u300cdata\u30aa\u30d7\u30b7\u30e7\u30f3\u300d\u306b\u7528\u610f\u3057\u305f\u5024\u3092\u5229\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u3092<span style=\"color: #ff0000;\"><strong>\u300c\u30c7\u30fc\u30bf\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u300d<\/strong><\/span>\u3068\u547c\u3073\u307e\u3059\u3002<\/p>\n<h3>data<\/h3>\n<p>\u30c7\u30fc\u30bf\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u3001\u5f8c\u304b\u3089\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u5024\u304c\u6c7a\u307e\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u3067\u3082\u7a7a\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>methods\u3068computed\u306e\u9055\u3044<\/h3>\n<h4>methods<\/h4>\n<p>\u30e1\u30bd\u30c3\u30c9\u306a\u306e\u3067\u3001\u547c\u3073\u51fa\u3057\u306b\uff08\uff09\u304c\u4ed8\u304f\u3002<\/p>\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u306a\u3044\u306e\u3067\u3001\u65e5\u6642\u306e\u8a08\u7b97\u7b49\u4f55\u5ea6\u3082\u547c\u3073\u51fa\u3057\u305f\u3044\u51e6\u7406\u306b\u5bfe\u3057\u3066\u4f7f\u3046\u3002<\/p>\n<h4>computed<\/h4>\n<p>\u30d7\u30ed\u30d1\u30c6\u30a3\u306a\u306e\u3067\u3001\u547c\u3073\u51fa\u3057\u306b\uff08\uff09\u304c\u4ed8\u304b\u306a\u3044\u3002<\/p>\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u308b\u306e\u3067\u3001\u4e00\u5ea6\u3060\u3051\u547c\u3073\u51fa\u3057\u305f\u65b9\u304c\u826f\u3044\u51e6\u7406\u306b\u95a2\u3057\u3066\u306f\u3001\u30b3\u30c1\u30e9\u3092\u512a\u5148\u3057\u3066\u4f7f\u3046\u3002<\/p>\n<h3>\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30d5\u30c3\u30af<\/h3>\n<p>\u4e0a\u3067\u89e3\u8aac\u3057\u305f\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30d5\u30c3\u30af\u3092\u5b9a\u7fa9\u3057\u3066\u3001\u6c7a\u307e\u3063\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u306b\u51e6\u7406\u3092\u5272\u308a\u8fbc\u307e\u305b\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<h3>template\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u306f\uff1f<\/h3>\n<p>\u305d\u306e\u307e\u307e\u30bf\u30b0\u3054\u3068HTML\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4e2d\u306b\u6d41\u3057\u8fbc\u3080\u4e8b\u304c\u53ef\u80fd\u3067\u3059\u3002Vue.js\u306eView\u306e\u4f5c\u308a\u65b9\u306e\u4e00\u3064\u306b\u306a\u308a\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u5168\u90e8\u4e38\u3005\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4e0a\u66f8\u304d\u3057\u3066\u3057\u307e\u3046\u6027\u8cea\u3092\u6301\u3064\u306e\u3067\u57fa\u672c\u7684\u306b\u306f\u4f7f\u308f\u306a\u3044\u6a5f\u80fd<\/strong><\/span>\u306b\u306f\u306a\u308a\u307e\u3059\u304c\u3001\u3053\u3046\u3044\u3046\u6a5f\u80fd\u3082\u3042\u308b\u306e\u3060\u3068\u3044\u3046\u3053\u3068\u3092\u8a8d\u8b58\u3057\u3066\u304a\u304f\u3053\u3068\u306f\u91cd\u8981\u3067\u3059\u3002<\/p>\n<h4>\u4f8b<\/h4>\n<p>\u300c&lt;p&gt;\u3053\u3093\u306b\u3061\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3059\u3002&lt;\/p&gt;\u300d\u304c\u300c&lt;div id=\"app2\"&gt; &lt;\/div&gt;\u300d\u306e\u306a\u304b\u306b\u633f\u5165\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">  &lt;div id=\"app2\"&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;script&gt;\r\n    const txt = \"\u30c6\u30ad\u30b9\u30c8\";\r\n    let vm2 = new Vue({\r\n      el: \"#app2\",\r\n      data: {\r\n        message: \"\u30c6\u30b9\u30c8\",\r\n        text: txt\r\n      },\r\n      template: '&lt;p&gt;\u3053\u3093\u306b\u3061\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3059\u3002&lt;\/p&gt;'\r\n    })<\/pre>\n<h4>$mount\u3092\u7c21\u5358\u306b\u8a18\u8ff0\u3067\u304d\u308b\u3002<\/h4>\n<p>\u901a\u5e38\u306e\u5834\u5408\u306fVue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u683c\u7d0d\u3057\u305f\u5909\u6570\u304b\u3089$mount\u3092\u547c\u3073\u51fa\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u304c\u3001template\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u672b\u5c3e\u306b$mount\u3092\u3064\u3051\u308b\u4e8b\u3067\u30de\u30a6\u30f3\u30c8\u3059\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">    new Vue({\r\n      data: {\r\n        message: \"\u30c6\u30b9\u30c8\",\r\n        text: txt\r\n      },\r\n      template: '&lt;p&gt;\u3053\u3093\u306b\u3061\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3059\u3002&lt;\/p&gt;'\r\n    }).$mount('#app2')<\/pre>\n<h2>\u5916\u5074\u304b\u3089Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306b\u306f\uff1f<\/h2>\n<p>\u4e00\u65e6<span style=\"color: #ff0000;\"><strong>\u5909\u6570\u306bVue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u683c\u7d0d<\/strong><\/span>\u3059\u308c\u3070\u5225\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u53c2\u7167\u3084\u66f4\u65b0\u3092\u304b\u3051\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">  &lt;div id=\"app\"&gt;\r\n    {{animals}}\r\n  &lt;\/div&gt;\r\n\r\n  &lt;div id=\"app2\"&gt;\r\n    &lt;button @click=\"click\"&gt;\u30dc\u30bf\u30f3&lt;\/button&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;script&gt;\r\n    let vm = new Vue({\r\n      el: \"#app\",\r\n      data: {\r\n        animals: ['dog', 'cat', 'lion'],\r\n      },\r\n      methods: {\r\n        remove: function () {\r\n          this.animals.shift();\r\n        }\r\n      }\r\n    })\r\n\r\n    new Vue({\r\n      el: \"#app2\",\r\n      data: {\r\n        message: \"\u30c6\u30b9\u30c8\"\r\n      },\r\n      methods: {\r\n        click: function () {\r\n          console.log(vm.animals);\r\n        }\r\n      }\r\n    })\r\n\r\n  &lt;\/script&gt;<\/pre>\n<h3>Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5404\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u53d6\u5f97\u3084\u8a2d\u5b9a\u3059\u308b\u306b\u306f\uff1f<\/h3>\n<p>\u500b\u5225\u306edata\u5024\u7b49\u306f\u53d6\u5f97\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u500b\u5225\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u7b49\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u30aa\u30d7\u30b7\u30e7\u30f3\u540d<\/th>\n<th>\u53d6\u5f97\u3084\u8a2d\u5b9a\u65b9\u6cd5<\/th>\n<\/tr>\n<tr>\n<td>data\u306e\u53d6\u5f97<\/td>\n<td>this.$data(\u5916\u5074\u304b\u3089\u53d6\u5f97\u3059\u308b\u5834\u5408\u306fVue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u683c\u7d0d\u3057\u305f\u5909\u6570.$data)<\/td>\n<\/tr>\n<tr>\n<td>el\u306e\u8a2d\u5b9a<\/td>\n<td>\u300cVue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u683c\u7d0d\u3057\u305f\u5909\u6570.mount('#app')\u300d\u3068\u3059\u308c\u3070\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u57fa\u672c\u7684\u306b\u3001Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u30e6\u30fc\u30b6\u30fc\u304c\u4f7f\u3046\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u533a\u5225\u3059\u308b\u305f\u3081\u306b\u305d\u308c\u4ee5\u5916\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u3064\u3044\u3066\u306f<span style=\"color: #ff0000;\"><strong>$<\/strong><\/span>\u304c\u3064\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Vue.js\u3067\u306f\u300cnew Vue\u300d\u3084\u300cVue.component\u300d\u7b49\u306e\u69cb\u6587\u306b\u3088\u3063\u3066\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u4f5c\u6210\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u3092\u305f\u3069\u308a\u307e\u3059\u3002 \u53c2\u8003\uff1ahttps:\/\/jp. [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[60],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/6083"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6083"}],"version-history":[{"count":13,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/6083\/revisions"}],"predecessor-version":[{"id":20634,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/6083\/revisions\/20634"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6083"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}