{"id":5727,"date":"2020-01-29T23:04:34","date_gmt":"2020-01-29T14:04:34","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=5727"},"modified":"2020-03-11T08:09:51","modified_gmt":"2020-03-10T23:09:51","slug":"vue%e3%83%9f%e3%83%83%e3%82%af%e3%82%b9%e3%82%a4%e3%83%b3-%e3%81%a8-vue%e3%82%b3%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%8d%e3%83%b3%e3%83%88%e3%81%ae%e4%bd%b5%e7%94%a8%e3%81%a7%e6%b0%97%e3%82%92%e3%81%a4","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=5727","title":{"rendered":"Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3 \u3068 Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u4f75\u7528\u3067\u6c17\u3092\u3064\u3051\u308b\u3079\u304d\u3053\u3068"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3061\u3087\u3063\u3068\u4eca\u306e\u958b\u767a\u304c\u591a\u5fd9\u3067\u30d6\u30ed\u30b0\u8a18\u4e8b\u3092\u304a\u4f11\u307f\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u304c\u3001\u304a\u304b\u3052\u3067\u3044\u304f\u3064\u304b\u516c\u958b\u3057\u305f\u3044\u5185\u5bb9\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u305d\u306e\u305f\u3081\u3001\u307e\u305f\u300c\u597d\u304d\u3060\u304b\u3089\u3084\u3063\u3066\u308b\u300d\u3050\u3089\u3044\u306e\u3086\u308b\u3044\u30b9\u30bf\u30f3\u30b9\u3067\u66f4\u65b0\u3092\u3057\u3066\u3044\u3053\u3046\u3068\u8003\u3048\u3066\u3044\u307e\u3059\ud83d\ude0a<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u306e\u5185\u5bb9\u306f\u79c1\u304c\u5b9f\u969b\u306b\u906d\u9047\u3057\u3066\u300c<strong>\u3042\u3001\u3057\u307e\u3063\u305f\ud83d\udca6<\/strong>\u300d\u3068\u306a\u3063\u305f\u4f53\u9a13\u304c\u5143\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u305c\u3072\u7686\u3055\u3093\u3082\u6c17\u3092\u3064\u3051\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306b\u306f\u3068\u3044\u3046\u3068\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3068Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f75\u7528\u3059\u308b\u3068\u304d\u306f\u6ce8\u610f\u304c\u5fc5\u8981\uff01<\/strong><\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u9806\u3092\u8ffd\u3063\u3066\u3054\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n<span style=\"font-size:1rem;\">\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/span><\/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><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Vue 2.6<\/p>\n<h1>\u4f55\u304c\u554f\u984c\u3068\u306a\u3063\u305f\u304b<\/h1>\n<p>\u307e\u305a\u79c1\u304c\u906d\u9047\u3057\u3066\u300c\u3042<strong>\u30fb\u30fb\u30fb<\/strong>\u300d\u3068\u306a\u3063\u305f\u73fe\u8c61\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u30b5\u30a4\u30c8\u306b\u5171\u901a\u3067\u8868\u793a\u3059\u308b\u60c5\u5831\uff08\u30b5\u30a4\u30c9\u30d0\u30fc\u306e\u65b0\u7740\u60c5\u5831\u306a\u3069\uff09\u3092<code>Ajax<\/code>\u3067\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3044\u3064\u3082\u306e\u3054\u3068\u304f<code>Vue<\/code>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u300c\u4f7f\u3044\u56de\u3057\u300d\u304c\u3067\u304d\u308b\u958b\u767a\u3092\u9032\u3081\u3066\u3044\u308b\u3068\u3001\u3042\u308b\u51fa\u6765\u4e8b\u306b\u6c17\u304c\u4ed8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u4f55\u5ea6\u3082\u540c\u3058Ajax\u901a\u4fe1\u304c\u767a\u751f<\/strong><\/p>\n<p>\u3057\u3066\u3044\u305f\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u2193\u2193\u2193<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5728\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/01\/vue_mixin_component_1.png\" alt=\"\" width=\"242\" height=\"159\"><\/p>\n<p>\u3082\u3061\u308d\u3093\u3001URL\u3082\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3082\u5168\u304f\u540c\u3058\u306a\u306e\u3067\u3001\u300c<strong>\u3044\u3084\u3001\uff11\u56de\u3067\u3044\u3044\u3067\u3057\u3087<\/strong>\ud83d\ude05\u300d\u3068\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<h1>\u4f55\u3092\u3069\u3046\u3057\u3066\u3044\u305f\u306e\u304b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3093\u306a\u72b6\u614b\u306b\u306a\u3063\u305f\u72b6\u6cc1\u306f\u3069\u3093\u306a\u3082\u306e\u3060\u3063\u305f\u306e\u304b\u3092\u3054\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u3063\u305f<\/h2>\n<p>\u307e\u305a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\/js\/vue\/components\/test.js<\/strong><\/p>\n<pre><strong>Vue.component('v-test', {<\/strong>\n<strong>    template: '\u30c6\u30b9\u30c8\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8'<\/strong>\n<strong>});<\/strong><\/pre>\n<h2>Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3082\u3064\u304f\u308a\u307e\u3057\u305f<\/h2>\n<p>\u300c<strong>Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3<\/strong>\u300d\u3068\u306f\u3001<strong>\u7279\u5b9a\u60c5\u5831\u306b\u3069\u3053\u304b\u3089\u3067\u3082\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u6a5f\u80fd<\/strong>\u306e\u3053\u3068\u3067\u3001\u4f8b\u3048\u3070\u3001\u300c\u6570\u5b57\u3092\uff13\u6841\u30ab\u30f3\u30de\u533a\u5207\u308a\u306b\u3059\u308b\u95a2\u6570\u300d\u306a\u3069\u306f\u4fbf\u5229\u306a\u306e\u3067\u3001\u3088\u304f\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u306e\u4e2d\u306b\u5165\u308c\u3066\u304a\u3044\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u5192\u982d\u3067\u3082\u66f8\u3044\u305f\u3088\u3046\u306b\u5168\u30da\u30fc\u30b8\u3067\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u53d6\u5f97\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<pre><strong>Vue.mixin({<\/strong>\n<strong>    mounted() {<\/strong>\n\n<strong>        \/\/ \u5168\u30da\u30fc\u30b8\u306b\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u53d6\u5f97<\/strong>\n<strong>        axios.get('\/api_app');<\/strong>\n\n<strong>    }<\/strong>\n<strong>});<\/strong><\/pre>\n<h2>Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3068Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f7f\u3063\u3066\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u305f<\/h2>\n<p>\u305d\u3057\u3066\u3001\u610f\u6c17\u63da\u3005\u3068\u3053\u3053\u307e\u3067\u3067\u4f5c\u3063\u305f<code>Vue<\/code>\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3068<code>Vue<\/code>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f75\u7528\u3059\u308b\u30da\u30fc\u30b8\u3092\u3064\u304f\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre>&lt;html&gt;\n&lt;body&gt;\n    &lt;div id=\"app\"&gt;\n\n        <strong>&lt;v-test&gt;&lt;\/v-test&gt;<\/strong>\n<strong>        &lt;v-test&gt;&lt;\/v-test&gt;<\/strong>\n<strong>        &lt;v-test&gt;&lt;\/v-test&gt;<\/strong>\n<strong>        &lt;v-test&gt;&lt;\/v-test&gt;<\/strong>\n<strong>        &lt;v-test&gt;&lt;\/v-test&gt;<\/strong>\n\n    &lt;\/div&gt;\n    &lt;!-- \u30e9\u30a4\u30d6\u30e9\u30ea --&gt;\n    &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.11\"&gt;&lt;\/script&gt;\n    &lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.19.2\/axios.min.js\"&gt;&lt;\/script&gt;\n    &lt;!-- Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3001\u30df\u30c3\u30af\u30b9\u30a4\u30f3 --&gt;\n    <strong>&lt;script src=\"\/js\/vue\/mixins\/app.js\"&gt;&lt;\/script&gt;<\/strong>\n<strong>    &lt;script src=\"\/js\/vue\/components\/test.js\"&gt;&lt;\/script&gt;<\/strong>\n    &lt;script&gt;\n\n        new Vue({\n            el: '#app'\n        });\n\n    &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<p>\u3057\u304b\u3057\uff01<\/p>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u305b\u3044\u3067\u3001\u3055\u3063\u304d\u306e\u300c<strong>\u3044\u3084\u3001\uff11\u56de\u3067\u3044\u3044\u3067\u3057\u3087<\/strong>\ud83d\ude05\u300d\u304c\u5f15\u304d\u8d77\u3053\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3059\u3002<\/p>\n<h1>\u4f55\u304c\u554f\u984c\u3060\u3063\u305f\u306e\u304b<\/h1>\n<p>\u3067\u306f\u3001\u4f55\u304b\u554f\u984c\u3060\u3063\u305f\u306e\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u539f\u56e0\u3068\u3057\u3066\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u8a2d\u5b9a\u3057\u3066\u3057\u307e\u3063\u305f\u304b\u3089<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u203b\u3053\u3053\u3067\u8a00\u3046\u300c\u30b0\u30ed\u30fc\u30d0\u30eb\u300d\u3068\u306f\u3001\u82f1\u8a9e\u3092\u4f7f\u3046\u3053\u3068\u3084\u56fd\u969b\u611f\u899a\u3092\u3082\u3064\u3068\u3044\u3046\u610f\u5473\u3067\u306f\u306a\u304f\u3001\u300c<strong>\u3069\u3053\u304b\u3089\u3067\u3082\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b<\/strong>\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u7d50\u8ad6\u304b\u3089\u3044\u3046\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3092\u4f5c\u308b\u3068\u3001<\/p>\n<pre><strong>Vue.mixin({<\/strong>\n\n    \/\/ \u7701\u7565\n\n<strong>});<\/strong><\/pre>\n<p><strong style=\"font-size: 35px;\">\u5168Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3053\u306e\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u304c\u6709\u52b9\u306b\u306a\u308b<\/strong><\/p>\n<p>\u306e\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u4eca\u56de\u306e\u4f8b\u3067\u8a00\u3046\u3068\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c85\u3064\u5206\u306e<code>Ajax<\/code>\u901a\u4fe1\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3063\u305f\u3093\u3067\u3059\u3002<\/p>\n<h1>\u3067\u306f\u3001\u3069\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u3044\u3044\u304b<\/h1>\n<p>\u89e3\u6c7a\u7b56\u3068\u3057\u3066\uff12\u3064\u3054\u7d39\u4ecb\u3057\u307e\u3059\u304c\u3001\u7c21\u5358\u306b\u8a00\u3046\u3068\u3001<\/p>\n<ol>\n<li>\u3072\u3068\u3064\u305a\u3064\u5fc5\u8981\u306a\u5834\u6240\u3067\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5<\/li>\n<li>\u4e00\u6c17\u306b\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5<\/li>\n<\/ol>\n<p>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3072\u3068\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<h2>\u3072\u3068\u3064\u305a\u3064\u5fc5\u8981\u306a\u5834\u6240\u3067\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5<\/h2>\n<p>\uff11\u3064\u76ee\u306f\u3001\u3088\u304f\u89e3\u6c7a\u7b56\u3068\u3057\u3066\u4f7f\u308f\u308c\u308b\u300c<strong>\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3092\u30ed\u30fc\u30ab\u30eb\u3067\u4f7f\u3046<\/strong>\u300d\u65b9\u6cd5\u3067\u3059\u3002\uff08\u30b0\u30ed\u30fc\u30d0\u30eb\u306e\u9006\u3067\u3059\u306d\uff09<\/p>\n<p>\u3084\u308a\u304b\u305f\u306f\u3001\u307e\u305a<code>Vue.mixin()<\/code>\u3092\u4f7f\u308f\u305a\u5358\u306a\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\/js\/vue\/mixins\/app.js<\/strong><\/p>\n<pre><strong>const appMixin = {<\/strong>\n<strong>    mounted() {<\/strong>\n\n<strong>        axios.get('\/api_app');<\/strong>\n\n<strong>    }<\/strong>\n<strong>};<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u4f7f\u3044\u305f\u3044\u5834\u6240\u3067\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>&lt;script src=\"\/js\/vue\/mixins\/app.js\"&gt;&lt;\/script&gt;<\/strong>\n&lt;script src=\"\/js\/vue\/components\/test.js\"&gt;&lt;\/script&gt;\n&lt;script&gt;\n\n    new Vue({\n        el: '#app',\n        <strong>mixins: [appMixin]<\/strong>\n    });\n\n&lt;\/script&gt;<\/pre>\n<p>\u3082\u3061\u308d\u3093\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3082\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>Vue.component('v-test', {\n    template: '\u30c6\u30b9\u30c8\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8',\n    <strong>mixins: [appMixin]<\/strong>\n});<\/pre>\n<p>\u306a\u304a\u3001<code>webpack<\/code>\u306a\u3069\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3066\u4f7f\u3046\u5834\u5408\u306f\u3001\u6b21\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>window.appMixin<\/strong> = {\n\n    \/\/ \u7701\u7565\n\n};<\/pre>\n<p><strong style=\"font-size: 35px;\">\u305f\u3060\u3057\u30fb\u30fb\u30fb<\/strong><\/p>\n<p>\u3053\u306e\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3092\u300c\u30ed\u30fc\u30ab\u30eb\u300d\u3068\u3057\u3066\u500b\u5225\u306b\u8a2d\u5b9a\u3059\u308b\u5834\u5408\u306f\u3001\u3061\u3087\u3063\u3068\u9762\u5012\u3060\u3063\u305f\u308a\u3059\u308b\u306e\u3082\u4e8b\u5b9f\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u6b21\u306f\u4e00\u6c17\u306b\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h1>\u4e00\u6c17\u306b\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5<\/h1>\n<p>\u3084\u308a\u65b9\u3068\u3057\u3066\u306f\u3001\u4e00\u756a\u6700\u521d\u306e<code>Vue.mixin()<\/code>\u3092\u4f7f\u3063\u305f\u30b0\u30ed\u30fc\u30d0\u30eb\u306a\u4f7f\u3044\u65b9\u306e\u5fdc\u7528\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p>\u7d50\u8ad6\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre>Vue.mixin({\n    mounted() {\n\n        if(<strong>this.$el.id === 'app'<\/strong>) {\n\n            \/\/ \u5168\u30da\u30fc\u30b8\u306b\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\n            axios.get('\/api_app');\n\n        }\n\n    }\n});<\/pre>\n<p><code>$el<\/code>\u306f\u3001<code>Vue<\/code>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u5bfe\u8c61\u306b\u3057\u3066\u3044\u308b\u8981\u7d20\u306e\u3053\u3068\u306a\u306e\u3067\u3001\u3053\u306e<code>id<\/code>\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066<code>Vue<\/code>\u672c\u4f53\u304b\u3069\u3046\u304b\u5224\u5225\u3057\u3066\u3044\u307e\u3059\u3002\uff08<code>id<\/code>\u306f\u3001\u91cd\u8907\u3059\u308b\u3053\u3068\u304c\u306a\u3044\u3053\u3068\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\uff09<\/p>\n<p>\u3064\u307e\u308a\u3001\u3053\u306e<code>id<\/code>\u306f\u3001<code>Vue<\/code>\u306e<code>el<\/code>\u306e\u90e8\u5206\u3068\u4e00\u81f4\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<pre>new Vue({\n    el: '#<strong>app<\/strong>'\n});<\/pre>\n<p>\u306a\u304a\u3001\u5143\u3005\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30af\u30e9\u30b9\u540d\u3092\u53d6\u5f97\u3057\u3066\u5224\u65ad\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3053\u306e\u65b9\u6cd5\u3060\u3068Vue\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\uff12\u3064\u4f5c\u3063\u305f\u5834\u5408\u306f\u5bfe\u5fdc\u3067\u304d\u307e\u305b\u3093\u3057\u3001\u306a\u306b\u3088\u308a<code>webpack<\/code>\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u3068\u30af\u30e9\u30b9\u540d\u304c\u5909\u66f4\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3046\u307e\u304f\u3044\u304d\u307e\u305b\u3093\u3002<\/p>\n<pre><strong>\/\/ \u3010\u6ce8\u610f\u3011\u3053\u308c\u306f\u304a\u3059\u3059\u3081\u3057\u306a\u3044\u65b9\u6cd5\u3067\u3059\u3002<\/strong>\n\nVue.mixin({\n    mounted() {\n\n        if(<strong>this.constructor.name === 'Vue'<\/strong>) {\n\n            \/\/ \u7701\u7565\n\n        }\n\n    }\n});<\/pre>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Vue<\/code>\u30df\u30c3\u30af\u30b9\u30a4\u30f3\u3068<code>Vue<\/code>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f75\u7528\u3059\u308b\u3068\u304d\u306b\u6c17\u3092\u3064\u3051\u3066\u304a\u304f\u3079\u304d\u3053\u3068\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u90e8\u5206\u306f\u3001\u30da\u30fc\u30b8\u306e\u901f\u5ea6\u306b\u3082\u95a2\u308f\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u305c\u3072\u30c6\u30af\u30cb\u30c3\u30af\u3068\u3057\u3066\u6d3b\u7528\u3057\u3066\u3044\u305f\u3060\u304d\u305f\u3044\u3067\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u5c11\u3057\u30c6\u30fc\u30de\u304b\u3089\u5916\u308c\u307e\u3059\u304c\u4eca\u56de\u306e\u8a18\u4e8b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u3066\u3001\u300c\u3042\u30fc\u3001\u3082\u3046\u5b8c\u5168\u306bES6\u3070\u304b\u308a\u4f7f\u3063\u3066\u308b\u306a\u300d\u3068\u5b9f\u611f\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3084\u3063\u3071\u308a\u30b3\u30fc\u30c9\u304c\u5c11\u306a\u304f\u3066\u3044\u3044\u306e\u306f\u3001\u3081\u3093\u3069\u304f\u3055\u304c\u308a\u5c4b\u306b\u3068\u3063\u3066\u300c\u30d3\u30fc\u30eb\u3092\u98f2\u3093\u3067\u308b\u3068\u304d\u306e\u5510\u63da\u3052\u300d\u306e\u3088\u3046\u306b\u9b45\u529b\u7684\u3067\u3059\u3002\uff08\u304a\u9152\u3092\u98f2\u307e\u308c\u306a\u3044\u65b9\u306f\u30b9\u30eb\u30fc\u3057\u3066\u304f\u3060\u3055\u3044\ud83d\ude05\uff09<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-461 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/38.png\" alt=\"\" width=\"294\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/38.png 294w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/38-276x300.png 276w\" sizes=\"auto, (max-width: 294px) 100vw, 294px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3061\u3087\u3063\u3068\u4eca\u306e\u958b\u767a\u304c\u591a\u5fd9\u3067\u30d6\u30ed\u30b0\u8a18\u4e8b\u3092\u304a\u4f11\u307f\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u304c\u3001\u304a\u304b\u3052\u3067\u3044\u304f\u3064\u304b\u516c\u958b\u3057\u305f\u3044\u5185\u5bb9\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u305d\u306e\u305f\u3081\u3001\u307e\u305f\u300c\u597d\u304d\u3060\u304b\u3089\u3084\u3063\u3066\u308b\u300d\u3050\u3089 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=5727\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Vue\u30df\u30c3\u30af\u30b9\u30a4\u30f3 \u3068 Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u4f75\u7528\u3067\u6c17\u3092\u3064\u3051\u308b\u3079\u304d\u3053\u3068&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":5732,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[68,148],"class_list":["post-5727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vue-js","tag-68","tag-148"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5727","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=5727"}],"version-history":[{"count":12,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5727\/revisions"}],"predecessor-version":[{"id":6175,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5727\/revisions\/6175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/5732"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}