{"id":530,"date":"2018-05-24T06:41:04","date_gmt":"2018-05-23T21:41:04","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=530"},"modified":"2018-05-24T06:41:04","modified_gmt":"2018-05-23T21:41:04","slug":"vue-js%e3%80%81%e5%85%a813%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%86%e3%82%a3%e3%83%96%e5%ae%9f%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=530","title":{"rendered":"Vue.js\u3001\u516813\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u5b9f\u4f8b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=523\">Vue component\u3067\u6c17\u3092\u3064\u3051\u308b\u3079\u304d\u3053\u3068\uff01<\/a>\u3068\u3044\u3046\u8a18\u4e8b\u3092\u6295\u7a3f\u3057\u307e\u3057\u305f\u3051\u3069\u3001\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u3044\u308b\u6700\u4e2d\u306b\u3075\u3068\u601d\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304c\u3001\u300c\u305d\u3046\u3044\u3048\u3070Vue\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\uff08\u4f8b\uff1av-if\uff09\u3063\u3066\u5168\u90e8\u77e5\u3063\u3066\u308b\u3093\u3060\u308d\u3046\u304b\uff1f\uff1f\u300d\u3068\u3002<\/p>\n<p>\u4ed6\u306eJS\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3082\u305d\u3046\u306a\u3093\u3067\u3059\u3051\u3069\u3001\u6700\u8fd1\u306f\u30db\u30f3\u30c8\u306b\u9032\u5316\u304c\u65e9\u3044\u3093\u3067\u3001\u5f8c\u304b\u3089\u300c\u3048\uff01\u305d\u3093\u306a\u4fbf\u5229\u306a\u3082\u306e\u304c\u3042\u3063\u305f\u306e\u304b\u30fb\u30fb\u30fb\u6642\u9593\u3092\u7121\u99c4\u306b\u3057\u3066\u3044\u305f\u3088\uff08\u6c57\uff09\u300d\u3068\u306a\u308b\u3053\u3068\u3082\u591a\u3005\u3042\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3001\u305d\u3046\u306a\u3089\u306a\u3044\u305f\u3081\u306b\u4eca\u56de\u306fVue\u306e\u5168\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u5b9f\u4f8b\u3067\u307e\u3068\u3081\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-427 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24.png\" alt=\"\" width=\"182\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24.png 182w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24-171x300.png 171w\" sizes=\"auto, (max-width: 182px) 100vw, 182px\" \/><\/p>\n<h1>v-on<\/h1>\n<p>\u30a4\u30d9\u30f3\u30c8\u3092\u6307\u5b9a\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u306d\u3002jQuery\u3067\u3044\u3046\u3068\u3053\u308d\u306e\u300c<strong>on(&#8216;****&#8217;)<\/strong>\u300d\u3002<\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>&lt;button type=\"button\" <strong>v-on:click=\"onClick()\"<\/strong>&gt;\u30dc\u30bf\u30f3&lt;\/button&gt;<\/pre>\n<p>\u305d\u3057\u3066\u3001\u547c\u3073\u51fa\u3055\u308c\u308b\u5074\u306fmethods\u306e\u4e2d\u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    methods: {\r\n        <strong>onClick: function() {<\/strong>\r\n\r\n<strong>            alert('\u30af\u30ea\u30c3\u30af\u3055\u308c\u307e\u3057\u305f\uff01');<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u305f\u3060\u3001\u5b9f\u969b\u306b\u79c1\u304c\u3088\u304f\u4f7f\u3046\u306e\u306f\u300c<strong>v-on:*****<\/strong>\u300d\u306e\u65b9\u3067\u306f\u306a\u304f\u3001\u7701\u7565\u5f62\u306e\u300c<strong>@*****<\/strong>\u300d\u3067\u3059\u3002\u540c\u3058\u52d5\u304d\u306a\u3089\u3067\u304d\u308b\u3060\u3051\u30b3\u30fc\u30c9\u306f\u5c11\u306a\u3044\u307b\u3046\u304c\u53ef\u8aad\u6027\u304c\u4e0a\u304c\u308b\u306e\u3067\u3002<\/p>\n<pre>&lt;button type=\"button\" <strong>@click=\"onClick()\"<\/strong>&gt;\u30dc\u30bf\u30f3&lt;\/button&gt;<\/pre>\n<p>\u307e\u305f\u3001\u3082\u3061\u308d\u3093\u30dc\u30bf\u30f3\u3060\u3051\u3058\u3083\u306a\u304f<strong>\u30ea\u30f3\u30af\u3084\u5165\u529b\u30dc\u30c3\u30af\u30b9\u306b\u3082\u30a4\u30d9\u30f3\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/strong><\/p>\n<pre>&lt;a href=\"#\" <strong>@click.prevent=\"onClick()\"<\/strong>&gt;\u30ea\u30f3\u30af&lt;\/a&gt;<\/pre>\n<p>\u203b\u30ea\u30f3\u30af\u306e\u5834\u5408\u306f\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30a4\u30d9\u30f3\u30c8\u5b9f\u884c\u6642\u306b\u30a2\u30c9\u30ec\u30b9\u304c\u300c#\u300d\u306b\u79fb\u52d5\u3057\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u300cprevent\u300d\u3092\u4f7f\u3063\u3066\u30a2\u30c9\u30ec\u30b9\u306e\u5909\u66f4\u3092\u963b\u6b62\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;input type=\"text\" <strong>@keyup.enter=\"onKeyupEnter()\"<\/strong>&gt;<\/pre>\n<p>\u203b\u3053\u306e\u4f8b\u306f\u30a8\u30f3\u30bf\u30fc\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u306b\u30a4\u30d9\u30f3\u30c8\u5b9f\u884c\u3055\u308c\u308b\u4f8b\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u4ed6\u306b\u3082\u8272\u3005\u306a\u30a4\u30d9\u30f3\u30c8\u62e1\u5f35\u6a5f\u80fd\u304c\u3042\u308b\u306e\u3067\u3001\u8208\u5473\u304c\u3042\u308b\u5834\u5408\u306f<a href=\"https:\/\/jp.vuejs.org\/v2\/guide\/events.html\" target=\"_blank\" rel=\"noopener\">\u3053\u3061\u3089<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>v-for<\/h1>\n<p>\u305f\u304f\u3055\u3093\u306e\u30c7\u30fc\u30bf\u3092\u30eb\u30fc\u30d7\u3055\u305b\u308b\u547d\u4ee4\u6587\u3067\u3059\u3002\u3044\u308f\u3086\u308b\u300c<strong>for\u30eb\u30fc\u30d7<\/strong>\u300d\u3067\u3059\u306d\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u540d\u524d\u30c7\u30fc\u30bf\u3092\u6301\u3063\u305f\u914d\u5217\u3092\u30eb\u30fc\u30d7\u3055\u305b\u3066\u8868\u793a\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n<strong>        names: [<\/strong>\r\n<strong>            '\u6843\u592a\u90ce',<\/strong>\r\n<strong>            '\u91d1\u592a\u90ce',<\/strong>\r\n<strong>            '\u304b\u3050\u3084\u59eb',<\/strong>\r\n<strong>            '\u6d66\u5cf6\u592a\u90ce',<\/strong>\r\n<strong>            '\u4e00\u5bf8\u6cd5\u5e2b'<\/strong>\r\n<strong>        ]<\/strong>\r\n    }\r\n});<\/pre>\n<p>v-for\u306e\u4e2d\u306b\u300cin\u300d\u3092\u4f7f\u3063\u3066\u5404\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u8a18\u8ff0\u3092\u3057\u307e\u3059\u3002\uff08Python\u3068\u4f3c\u3066\u307e\u3059\u306d\u3002\uff09<\/p>\n<pre>&lt;div <strong>v-for=\"name in names\"<\/strong>&gt;{{ name }}&lt;\/div&gt;<\/pre>\n<p>\uff08\u5b9f\u884c\u7d50\u679c\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-531\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives.png\" alt=\"\" width=\"110\" height=\"133\" \/><\/p>\n<p>\u3061\u306a\u307f\u306b\u300cv-for\u300d\u306b\u306f\u8272\u3005\u306a\u8ffd\u52a0\u6a5f\u80fd\u304c\u5099\u308f\u3063\u3066\u3044\u3066\u3001\u914d\u5217\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3084\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u306e\u3082\u7c21\u5358\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u3055\u3063\u304d\u306e\u4f8b\u3092\u4f7f\u3046\u3068\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>&lt;<\/strong>div <strong>v-for=\"(name,id) in names\"<\/strong>&gt;{{ <strong>name<\/strong> }}\uff08Index: {{ <strong>id<\/strong> }}\uff09&lt;\/div&gt;<\/pre>\n<p>\uff08\u5b9f\u884c\u7d50\u679c\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-532\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-1.png\" alt=\"\" width=\"165\" height=\"131\" \/><\/p>\n<p>\u3067\u306f\u3001\u30c7\u30fc\u30bf\u304c\u300c\u30ad\u30fc\u300d\u3092\u6301\u3064\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5834\u5408\u3082\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n<strong>        names: {<\/strong>\r\n<strong>            momo: '\u6843\u592a\u90ce',<\/strong>\r\n<strong>            kin: '\u91d1\u592a\u90ce',<\/strong>\r\n<strong>            kaguya: '\u304b\u3050\u3084\u59eb',<\/strong>\r\n<strong>            ura: '\u6d66\u5cf6\u592a\u90ce',<\/strong>\r\n<strong>            issun: '\u4e00\u5bf8\u6cd5\u5e2b'<\/strong>\r\n<strong>        }<\/strong>\r\n    }\r\n});<\/pre>\n<pre><strong>&lt;div v-for=\"(name,key) in names\"<\/strong>&gt;{{ <strong>name<\/strong> }}\uff08\u30ad\u30fc: {{ <strong>key<\/strong> }}\uff09&lt;\/div&gt;<\/pre>\n<p>\uff08\u5b9f\u884c\u7d50\u679c\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-533\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-2.png\" alt=\"\" width=\"207\" height=\"136\" \/><\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3060\u3051\u3069\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3082\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u5909\u6570\u3092\uff13\u3064\u76ee\u306b\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067OK\u3067\u3059\u3002<\/p>\n<pre>&lt;div <strong>v-for=\"(name,key,id) in names\"<\/strong>&gt;{{ <strong>name<\/strong> }}\uff08\u30a4\u30f3\u30c7\u30c3\u30af\u30b9: {{ <strong>id<\/strong> }}\uff09\uff08\u30ad\u30fc: {{ <strong>key<\/strong> }}\uff09&lt;\/div&gt;<\/pre>\n<p>\uff08\u5b9f\u884c\u7d50\u679c\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-534\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-3.png\" alt=\"\" width=\"368\" height=\"138\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-3.png 368w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-3-300x113.png 300w\" sizes=\"auto, (max-width: 368px) 100vw, 368px\" \/><\/p>\n<p>\u203b\u3061\u306a\u307f\u306b<a href=\"https:\/\/blog.capilano-fw.com\/?p=84\">v-for\u3092\u4f7f\u3046\u3068\u304d\u306b\u6c17\u3092\u3064\u3051\u3066\u304a\u304f\u3079\u304d\u3053\u3068<\/a>\u3082\u8a18\u4e8b\u3067\u516c\u958b\u3057\u3066\u3044\u308b\u306e\u3067\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>v-bind<\/h1>\n<p>Vue\u3092\u4f7f\u3046\u4e0a\u3067\u6700\u3082\u4fbf\u5229\u306a\u6a5f\u80fd\u300c\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u300d\u3092\u8a2d\u5b9a\u3059\u308b\u547d\u4ee4\u6587\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u306f\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u3059\u3002<br \/>\n\u307e\u305a\u306f\u30c7\u30fc\u30bf\u306b\u300curl\u300d\u3092\u8ffd\u52a0\u3057\u3066\u3001<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>url: 'http:\/\/yahoo.co.jp'<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30ea\u30f3\u30af\u306b\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;a <strong>v-bind:href=\"url\"<\/strong>&gt;\u30ea\u30f3\u30af&lt;\/a&gt;<\/pre>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30c7\u30fc\u30bf\u3067\u6307\u5b9a\u3057\u305fURL\u304c\u30ea\u30f3\u30af\u306e\u300chref\u300d\u306b\u5165\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;a <strong>href=\"http:\/\/yahoo.co.jp\"<\/strong>&gt;\u30ea\u30f3\u30af&lt;\/a&gt;<\/pre>\n<p>\u3082\u3061\u308d\u3093\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300curl\u300d\u306e\u4e2d\u8eab\u304c\u5909\u66f4\u306b\u306a\u308b\u3068\u3001\u81ea\u52d5\u7684\u306b\u30ea\u30f3\u30af\u306e\u300chref\u300d\u304c\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        url: 'http:\/\/yahoo.co.jp'\r\n    },\r\n    mounted: function() {\r\n\r\n        <strong>this.url = 'http:\/\/google.com';<\/strong>\r\n\r\n    }\r\n});<\/pre>\n<p>\uff08\u81ea\u52d5\u7684\u306b\u5909\u66f4\u306b\u306a\u308b\uff09<\/p>\n<pre>&lt;a <strong>href=\"http:\/\/google.com\"<\/strong>&gt;\u30ea\u30f3\u30af&lt;\/a&gt;<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001\u300c<strong>v-bind<\/strong>\u300d\u306b\u3082\u300c<strong>v-on<\/strong>\u300d\u3068\u540c\u3058\u304f\u7701\u7565\u5f62\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u66f8\u304d\u65b9\u306f\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u3059\u3002<strong>\u300cv-bind\u300d\u306e\u90e8\u5206\u3092\u3054\u3063\u305d\u308a\u306a\u304f\u3057\u3066\u3057\u307e\u3063\u3066\u3082\u3044\u3044\u3093\u3067\u3059\u3002<\/strong><\/p>\n<p>\uff08\u7701\u7565\u3057\u306a\u3044\u5f62\uff09<\/p>\n<pre>&lt;a <strong>v-bind:href=\"url\"<\/strong>&gt;\u30ea\u30f3\u30af&lt;\/a&gt;<\/pre>\n<p>\u2193\u2193\u2193\u7701\u7565\u5f62<\/p>\n<pre>&lt;a <strong>:href=\"url\"<\/strong>&gt;\u30ea\u30f3\u30af&lt;\/a&gt;<\/pre>\n<p>\u3068\u3066\u3082\u30b9\u30c3\u30ad\u30ea\u3057\u305f\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u6b21\u306b\u3001\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\uff08CSS\uff09\u3092\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u65b9\u6cd5\u3082\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u3084\u308a\u65b9\u306f\u8272\u3005\u3068\u3042\u308a\u307e\u3059\u3051\u3069\u3001\u3053\u3053\u3067\u306f\u300ccomputed\u300d\u3092\u4f7f\u3046\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bcss\u3092\u8fd4\u3059<strong>computed<\/strong>\u3092\u4f5c\u3063\u3066\u304a\u3044\u3066\u3001<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n<strong>    computed: {<\/strong>\r\n<strong>        css: function() {<\/strong>\r\n\r\n<strong>            return 'text-bold';<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u3068\u3001\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<pre>&lt;div <strong>:class=\"css\"<\/strong>&gt;\u30c6\u30ad\u30b9\u30c8&lt;\/div&gt;<\/pre>\n<p>\u7d50\u679c\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>&lt;div <strong>class=\"text-bold\"<\/strong>&gt;\u30c6\u30ad\u30b9\u30c8&lt;\/div&gt;<\/pre>\n<p>\u307e\u305f\u3001CSS\u3092\u3042\u308b\u6761\u4ef6\u3067\u5207\u308a\u66ff\u3048\u305f\u3044\u5834\u5408\u306f\u3001<strong>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u3067\u304d\u307e\u3059\u3002<\/strong><\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    computed: {\r\n        css: function() {\r\n\r\n<strong>            return {<\/strong>\r\n<strong>                'switch-css': true<\/strong>\r\n<strong>            };\r\n<\/strong>\r\n        }\r\n    }\r\n});<\/pre>\n<p>\u4e0a\u306e\u4f8b\u3067\u306f\u3001\u300cswitch-css\u300d\u304c\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u5b9f\u884c\u7d50\u679c\u306f\u3001<\/p>\n<pre>&lt;div <strong>class=\"switch-css\"<\/strong>&gt;\u30c6\u30ad\u30b9\u30c8&lt;\/div&gt;<\/pre>\n<p>\u3068\u306a\u308a\u307e\u3059\u304c\u3001\u3082\u3057\u300cswitch-css\u300d\u304c\u300c<strong>false<\/strong>\u300d\u3060\u3063\u305f\u5834\u5408\u306f\u3001<\/p>\n<pre>&lt;div&gt;\u30c6\u30ad\u30b9\u30c8&lt;\/div&gt;<\/pre>\n<p>\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u203b\u3061\u306a\u307f\u306b\u300c<strong>v-bind:style<\/strong>\u300d\u306e\u5834\u5408\u3082\u540c\u69d8\u306b\u3067\u304d\u307e\u3059\u3002\u305c\u3072\u6d3b\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>v-model<\/h1>\n<p>\u30a4\u30f3\u30d7\u30c3\u30c8\u30c7\u30fc\u30bf\u3092\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002\u3053\u308c\u3092\u4f7f\u3048\u3070\u3001\u5165\u529b\u30dc\u30c3\u30af\u30b9\u306e\u30c7\u30fc\u30bf\u306b\u5909\u66f4\u304c\u3042\u3063\u305f\u3089\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067Vue\u5185\u306e\u30c7\u30fc\u30bf\u3082\u66f8\u304d\u63db\u308f\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u307e\u305a\u306f\u3001\u30c7\u30fc\u30bf\u306b\u300cname\u300d\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>name: '\u6843\u592a\u90ce'<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3067\u3001input\u30bf\u30b0\u306b\u300cv-model\u300d\u3092\u8a2d\u5b9a\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;input type=\"text\" <strong>v-model=\"name\"<\/strong>&gt;<\/pre>\n<p>\u3053\u3046\u3059\u308b\u3060\u3051\u3067\u3001<\/p>\n<ol>\n<li><strong>\u5165\u529b\u30dc\u30c3\u30af\u30b9\u306e\u4e2d\u8eab\u304c\u5909\u66f4\u3055\u308c\u305f\u3089\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u300cname\u300d\u306e\u5024\u304c\u5909\u308f\u308b<\/strong><\/li>\n<li><strong>\u300cname\u300d\u306e\u5024\u304c\u5909\u66f4\u3055\u308c\u305f\u3089\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u5165\u529b\u30dc\u30c3\u30af\u30b9\u306e\u4e2d\u8eab\u3082\u5909\u308f\u308b<\/strong><\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\uff12\u3064\u306e\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3092\u5b9f\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u5229\u7528\u3067\u304d\u308b\u306e\u306finput\u30bf\u30b0\u3060\u3051\u3058\u3083\u306a\u304f\u3001<strong>textarea<\/strong>\u3084<strong>select<\/strong>\u30bf\u30b0\u3067\u3082OK\u3067\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u30c7\u30fc\u30bf\u306e\u66f8\u304d\u63db\u3048\u304c\u53ef\u80fd\u306a\u306e\u3067\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u72b6\u6cc1\u306b\u5fdc\u3058\u3066\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5909\u5316\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001select\u30bf\u30b0\u3092\u4f7f\u3063\u305f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>&lt;select&gt;\r\n    &lt;option&gt;&lt;\/option&gt;\r\n    <strong>&lt;option v-for=\"(name,key) in names\" :value=\"key\" v-text=\"name\"&gt;&lt;\/option&gt;<\/strong>\r\n&lt;\/select&gt;<\/pre>\n<p>Vue\u672c\u4f53\u306f\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n<strong>        names: {\r\n            momo: '\u6843\u592a\u90ce',\r\n            kin: '\u91d1\u592a\u90ce',\r\n            kaguya: '\u304b\u3050\u3084\u59eb',\r\n            ura: '\u6d66\u5cf6\u592a\u90ce',\r\n            issun: '\u4e00\u5bf8\u6cd5\u5e2b'\r\n        }<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u540d\u524d\u3092\u9078\u629e\u3067\u304d\u308b\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-538\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/Screenshot-from-2018-05-24-04-45-33.png\" alt=\"\" width=\"94\" height=\"152\" \/><\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306b\u300c\u3082\u3057\u300e\u6843\u592a\u90ce\u300f\u304c\u9078\u3070\u308c\u305f\u3089\u3001\u300e\u3069\u3093\u3076\u3089\u3053\u301c\u300f\u3068\u8868\u793a\u300d\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u3053\u308c\u3082\u300cv-model\u300d\u3092\u4f7f\u3048\u3070\u7c21\u5358\u3067\u3059\u3002<\/p>\n<pre>&lt;select <strong>v-model=\"nameKey\"<\/strong>&gt;\r\n    &lt;option&gt;&lt;\/option&gt;\r\n    &lt;option v-for=\"(name,key) in names\" :value=\"key\" v-html=\"name\"&gt;&lt;\/option&gt;\r\n&lt;\/select&gt;\r\n<strong>&lt;div v-if=\"nameKey=='momo'\"&gt;\u3069\u3093\u3076\u3089\u3053\u301c&lt;\/div&gt;<\/strong><\/pre>\n<p>\u3055\u3063\u304d\u306e\u30b3\u30fc\u30c9\u306b\u3001\u300cv-model\u300d\u3068\u5bfe\u5fdc\u3059\u308b\u5909\u6570\u540d\u3001\u305d\u3057\u3066\u6761\u4ef6\u5206\u5c90\u306e\u300cv-if\u300d\u304c\u5165\u3063\u305fdiv\u30bf\u30b0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001v-model\u3067\u6307\u5b9a\u3057\u305f\u300cnameKey\u300d\u3092\u5909\u6570\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        names: {\r\n            momo: '\u6843\u592a\u90ce',\r\n            kin: '\u91d1\u592a\u90ce',\r\n            kaguya: '\u304b\u3050\u3084\u59eb',\r\n            ura: '\u6d66\u5cf6\u592a\u90ce',\r\n            issun: '\u4e00\u5bf8\u6cd5\u5e2b'\r\n        },\r\n        <strong>nameKey: ''<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u305f\u3063\u305f\u3053\u308c\u3060\u3051\u3067OK\u3002<br \/>\n\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u3001\u6843\u592a\u90ce\u3092\u9078\u3093\u3060\u3068\u304d\u3060\u3051\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-539\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-4.png\" alt=\"\" width=\"119\" height=\"58\" \/><\/p>\n<p>\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067v-model\u3092\u4f7f\u3046\u3068\u3001\u30bb\u30af\u30b7\u30e7\u30f3\u5206\u3051\u3057\u3066\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u9ad8\u901f\u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h1>v-if\uff0fv-else-if\uff0fv-else<\/h1>\n<p>\u300cv-if\u300d\u306f\u6761\u4ef6\u5206\u5c90\u3067\u8868\u793a\u3059\u308b\uff0f\u3057\u306a\u3044\u3092\u6c7a\u3081\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002<br \/>\n\u300cif\u6587\u300d\u306f\u3001\u307b\u307c\u3069\u3093\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306b\u3082\u3042\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u76f4\u611f\u7684\u306b\u308f\u304b\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u30c6\u30b9\u30c8\u306e\u70b9\u6570\u3092\u5909\u6570\u306b\u5165\u308c\u305f\u30b3\u30fc\u30c9\u3067\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>score: 100  \/\/ \u30c6\u30b9\u30c8\u306e\u70b9\u6570<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3082\u3057\u3001\u3053\u306e\u72b6\u614b\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u300cv-if\u300d\u3092\u542b\u3093\u3060HTML\u30bf\u30b0\u3092\u8ffd\u52a0\u3059\u308b\u3068\u3001\u4e2d\u8eab\u306e\u6761\u4ef6\u304c\u6b63\u3057\u304f\u306a\u308b\u306e\u3067\u3001\u300c100\u70b9\u6e80\u70b9\uff01\u300d\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>&lt;div <strong>v-if=\"score==100\"<\/strong>&gt;100\u70b9\u6e80\u70b9\uff01&lt;\/div&gt;<\/pre>\n<p>\u3067\u306f\u3001\u70b9\u6570\u309280\u70b9\u306b\u3057\u3066\u307f\u308b\u3068\u30fb\u30fb\u30fb\uff1f\uff1f\u6761\u4ef6\u5f0f\u304c\u6b63\u3057\u304f\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u4eca\u5ea6\u306f\u4f55\u3082\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>score: 80  \/\/ \u30c6\u30b9\u30c8\u306e\u70b9\u6570<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3067\u306f\u300180\u70b9\u306e\u5834\u5408\u3082\u8868\u793a\u3057\u305f\u3044\u5834\u5408\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300cv-else-if\u300d\u304c\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<pre>&lt;div v-if=\"score==100\"&gt;100\u70b9\u6e80\u70b9\uff01&lt;\/div&gt;\r\n&lt;div <strong>v-else-if=\"score==80\"<\/strong>&gt;80\u70b9\u3002\u304a\u3081\u3067\u3068\u3046\uff01&lt;\/div&gt;<\/pre>\n<p>\u3082\u3057\u304f\u306f\u300180\u70b9\u300c\u4ee5\u4e0a\u300d\u3067\u5206\u5c90\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u6761\u4ef6\u5f0f\u3092\u5909\u66f4\u3059\u308c\u3070OK\u3002<\/p>\n<pre>&lt;div v-if=\"score==100\"&gt;100\u70b9\u6e80\u70b9\uff01&lt;\/div&gt;\r\n&lt;div v-else-if=\"<strong>score&gt;=80<\/strong>\"&gt;80\u70b9\u4ee5\u4e0a\u3002\u304a\u3081\u3067\u3068\u3046\uff01&lt;\/div&gt;<\/pre>\n<p>\u3055\u3089\u306b\u3001\u305d\u308c\u4ee5\u5916\u306e\u300c<strong>v-else<\/strong>\u300d\u3092\u8ffd\u52a0\u3059\u308c\u3070\u3069\u3093\u306a\u70b9\u6570\u3067\u3082\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u203b\u300cv-else\u300d\u306b\u6761\u4ef6\u5f0f\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\uff09<\/p>\n<pre>&lt;div v-if=\"score==100\"&gt;100\u70b9\u6e80\u70b9\uff01&lt;\/div&gt;\r\n&lt;div v-else-if=\"score&gt;=80\"&gt;80\u70b9\u4ee5\u4e0a\u3002\u304a\u3081\u3067\u3068\u3046\uff01&lt;\/div&gt;\r\n<strong>&lt;div v-else&gt;\u3046\u30fc\u3093\u3001\u3001\u3001&lt;\/div&gt;<\/strong><\/pre>\n<h1>v-show<\/h1>\n<p>\u307b\u3068\u3093\u3069\u300cv-if\u300d\u3068\u540c\u3058\u3067\u3059\u3051\u3069\u3001\u8868\u793a\u306e\u4ed5\u65b9\u304c\u9055\u3044\u307e\u3059\u3002<\/p>\n<p>\u300cv-if\u300d\u306f\u6761\u4ef6\u304c\u6b63\u3057\u304f\u306a\u3063\u305f\u6642\u70b9\u3067\u3001\u65b0\u3057\u304f\u8981\u7d20\u3092\u4f5c\u308b\u306e\u306b\u5bfe\u3057\u3066\u3001\u300cv-show\u300d\u306e\u5834\u5408\u306f\u3001\u5358\u7d14\u306bCSS\u3067\u300c\u8868\u793a\uff0f\u975e\u8868\u793a\u300d\u3092\u5207\u308a\u66ff\u3048\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;div <strong>v-if=\"false\"<\/strong>&gt;v-if\u3067\u3059\u3002&lt;\/div&gt;\r\n&lt;div <strong>v-show=\"false\"<\/strong>&gt;v-show\u3067\u3059\u3002&lt;\/div&gt;<\/pre>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u4e21\u65b9\u3068\u3082\u30c6\u30ad\u30b9\u30c8\u306f\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002\u305f\u3060\u3057\u3001\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc\u30c4\u30fc\u30eb\u3067\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b\u3068\u3053\u3046\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;div id=\"app\"&gt;\r\n    <strong>&lt;div style=\"display: none;\"&gt;v-show\u3067\u3059\u3002&lt;\/div&gt;<\/strong>\r\n&lt;\/div&gt;<\/pre>\n<p>\u300cv-show\u300d\u306e\u65b9\u306fCSS\u3067\u8868\u793a\u304c\u6d88\u3055\u308c\u3066\u3044\u308b\u306e\u306b\u5bfe\u3057\u3066\u3001\u300cv-if\u300d\u306f\u8981\u7d20\u305d\u306e\u3082\u306e\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u3064\u307e\u308a\u3001\u3082\u3057\u5f8c\u3067\u6761\u4ef6\u5f0f\u304c\u6b63\u3057\u304f\u306a\u3063\u305f\u3089\u3001\u305d\u306e\u6642\u306b\u8981\u7d20\u3092\u8ffd\u52a0\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u308f\u3051\u3067\u3059\u306d\u3002\uff08null\u3068\u7a7a\u767d\u306e\u95a2\u4fc2\u306b\u4f3c\u3066\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff09<\/p>\n<h1>v-text\uff0fv-html<\/h1>\n<p>\u3069\u3061\u3089\u3082HTML\u30bf\u30b0\u5185\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u6307\u5b9a\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u307e\u305aVue\u672c\u4f53\u3002name\u304c\u3042\u308b\u3060\u3051\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u9020\u3067\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>name: '\u6843\u592a\u90ce'<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3067\u306fHTML\u30bf\u30b0\u306e\u65b9\u3067\u3059\u3002<\/p>\n<pre><strong>&lt;div v-text=\"name\"&gt;&lt;\/div&gt;<\/strong>\r\n<strong>&lt;div v-html=\"name\"&gt;&lt;\/div&gt;<\/strong><\/pre>\n<p>\u3054\u60f3\u50cf\u3069\u304a\u308a\u3001\uff12\u3064\u3068\u3082\u300c\u6843\u592a\u90ce\u300d\u3068\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u6b21\u306e\u5834\u5408\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>name: '\u6843\u592a\u90ce&lt;br&gt;\u91d1\u592a\u90ce'<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u524d\u3068\u9055\u3046\u306e\u306f\u3001\u8868\u793a\u3055\u305b\u305f\u3044\u30c6\u30ad\u30b9\u30c8\u5185\u306bHTML\u30bf\u30b0\u3092\u5165\u308c\u3066\u3042\u308b\u3068\u3044\u3046\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u8868\u793a\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-540\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-5.png\" alt=\"\" width=\"160\" height=\"90\" \/><\/p>\n<p>\u305d\u3046\u3067\u3059\u3002<strong>\u300cv-text\u300d\u306e\u5834\u5408\u306f\u30c6\u30ad\u30b9\u30c8\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u30bf\u30b0\u3082\u305d\u306e\u307e\u307e\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/strong>\u305d\u308c\u306b\u5bfe\u3057\u3001\u300cv-html\u300d\u306f\u30ad\u30c1\u30f3\u3068HTML\u307e\u3067\u89e3\u91c8\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u4e8c\u91cd\u62ec\u5f27\u3067\u3082\u540c\u3058\u3088\u3046\u306b\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;div&gt;<strong>{{ name }}<\/strong>&lt;\/div&gt;<\/pre>\n<p>\u305f\u3060\u3001\u3053\u308c\u306fVue\u3068\u306f\u95a2\u4fc2\u306a\u3044\u306e\u3067\u3059\u304c\u3001Laravel\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u3067\u4f7f\u304a\u3046\u3068\u3059\u308b\u3068\u540c\u3058\u304f\u4e8c\u91cd\u62ec\u5f27\u306fPHP\u30b3\u30fc\u30c9\u3068\u89e3\u91c8\u3055\u308c\u308b\u305f\u3081\u3001\u30a2\u30c3\u30c8\u30de\u30fc\u30af\u3092\u3064\u3051\u3066\u8868\u793a\u3055\u305b\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<pre>&lt;div&gt;<strong>@<\/strong>{{ name }}&lt;\/div&gt;<\/pre>\n<p>\u3053\u306e\u305f\u3081\u3001\u79c1\u306e\u74b0\u5883\u306e\u5834\u5408\u3067\u306f\u3088\u308a\u53ef\u8aad\u6027\u304c\u9ad8\u3044\u300cv-text\u300d\u3092\u512a\u5148\u7684\u306b\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>v-pre<\/h1>\n<p>\u4e2d\u8eab\u3092\u305d\u306e\u307e\u307e\u8868\u793a\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001<\/p>\n<pre>&lt;span <strong>v-pre<\/strong>&gt;{{ \u2190\u2190\u2190\u3000\u4e8c\u91cd\u62ec\u5f27\u3082\u8868\u793a\u3000\u2192\u2192\u2192 }}&lt;\/span&gt;<\/pre>\n<p>\u3068\u3059\u308b\u3068\u3001Vue\u306e\u30b3\u30fc\u30c9\u3068\u306f\u89e3\u91c8\u3055\u308c\u305a\u3001\u305d\u306e\u307e\u307e\u306e\u5f62\u3067\u30c6\u30ad\u30b9\u30c8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-541\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-6.png\" alt=\"\" width=\"291\" height=\"44\" \/><\/p>\n<h1>v-cloak<\/h1>\n<p>Vue\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u63cf\u753b\u304c\u6e96\u5099\u5b8c\u4e86\u3059\u308b\u307e\u3067\u3001HTML\u30bf\u30b0\u306b\u3068\u3069\u307e\u3063\u3066\u304f\u308c\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3046\u3068<strong>\u300c\u30da\u30fc\u30b8\u8868\u793a\u3057\u305f\u77ac\u9593\u306b\u30c1\u30e9\u30c3\u3068\u898b\u3048\u3066\u3057\u307e\u3046\u3001\u4e8c\u91cd\u62ec\u5f27\u3092\u8868\u793a\u3057\u306a\u3044\u300d\u3088\u3046\u306b\u3067\u304d\u307e\u3059\u3002<\/strong><\/p>\n<p>\u4f8b\u3048\u3070\u3001\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300cv-cloak\u300d\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u8a2d\u5b9a\u3092\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;style&gt;\r\n\r\n<strong>    [v-cloak] {<\/strong>\r\n<strong>        display: none;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n&lt;\/style&gt;<\/pre>\n<p>\u305d\u3057\u3066\u3001\u300cv-cloak\u300d\u3068\u4e8c\u91cd\u62ec\u5f27\u306e\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u304c\u5165\u3063\u305fdiv\u30bf\u30b0\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre>&lt;div <strong>v-cloak<\/strong>&gt;<strong>{{ name }}<\/strong>&lt;\/div&gt;<\/pre>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001<\/p>\n<ol>\n<li>\u30da\u30fc\u30b8\u8868\u793a\u6642\u306fv-cloak\u304c\u3042\u308b\u306e\u3067\u3001\u300c<strong>display:none<\/strong>\u300d\u304c\u6709\u52b9\uff08\u3064\u307e\u308a\u3001\u8868\u793a\u3055\u308c\u306a\u3044\uff09<\/li>\n<li>\u305d\u3057\u3066\u3001\u6e96\u5099\u304c\u5b8c\u4e86\u3057\u305f\u3089\u300cv-cloak\u300d\u304c\u306a\u304f\u306a\u308b\u306e\u3067CSS\u306e\u9069\u7528\u304c\u306a\u304f\u306a\u308a\u8868\u793a\u3055\u308c\u308b<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>v-once<\/h1>\n<p>v-once\u306f\u3001\u4e00\u56de\u3060\u3051\u8868\u793a\u3067\u304d\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002<br \/>\n\u3064\u307e\u308a\u3001\u5f8c\u3067\u5909\u6570\u306e\u4e2d\u8eab\u304c\u5909\u66f4\u306b\u306a\u3063\u3066\u3082\u6700\u521d\u306e\u307e\u307e\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>name: '\u6843\u592a\u90ce'<\/strong>\r\n    }\r\n});<\/pre>\n<p>Vue\u672c\u4f53\u306f\u3001\u30c7\u30fc\u30bf\u306b\u300cname\u300d\u304c\u5165\u3063\u305f\u3060\u3051\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u3082\u306e\u3067\u3059\u3002<\/p>\n<pre>&lt;div <strong>v-once<\/strong>&gt;{{ name }}&lt;\/div&gt;\r\n&lt;button type=\"button\" <strong>@click=\"name='\u91d1\u592a\u90ce'\"<\/strong>&gt;\u540d\u524d\u3092\u5909\u66f4&lt;\/button&gt;<\/pre>\n<p>\u305d\u3057\u3066\u3001HTML\u30b3\u30fc\u30c9\u3002<br \/>\n1\u884c\u76ee\u306f\u300cv-once\u300d\u304c\u5165\u3063\u305f\u30bf\u30b0\u3002\u305d\u3057\u3066\u30012\u884c\u76ee\u306f\u300c\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u3001name\u306e\u4e2d\u8eab\u3092\u91d1\u592a\u90ce\u306b\u5909\u66f4\u3059\u308b\u300d\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u8868\u793a\u306f\u3053\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-543\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-7.png\" alt=\"\" width=\"109\" height=\"64\" \/><\/p>\n<p>\u901a\u5e38\u306a\u3089\u3001\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308c\u3070\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u304c\u52b9\u3044\u3066\u3044\u308b\u306e\u3067\u300c\u6843\u592a\u90ce\u300d\u306f\u300c\u91d1\u592a\u90ce\u300d\u306b\u5909\u66f4\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u304c\u3001<strong>\u4eca\u56de\u306f\u300cv-once\u300d\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u304c\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u4f55\u3082\u5909\u66f4\u3055\u308c\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/strong><\/p>\n<h1>\u72ec\u81ea\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u3064\u304f\u308b<\/h1>\n<p>\u8272\u3005\u3068\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u3051\u3069\u3001\u5b9f\u306fVue\u306f\u81ea\u5206\u3067\u72ec\u81ea\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u3064\u304f\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\uff08\u3053\u3046\u3044\u3046\u30d5\u30ec\u30ad\u30b7\u30d6\u30eb\u306a\u3068\u3053\u308d\u304c\u5b09\u3057\u3044\u3067\u3059\u3088\u306d\u3002\uff09<\/p>\n<p>\u3067\u306f\u3001\u3053\u308c\u3082\u4f8b\u3067\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4f8b\u3048\u3070\u3001\u300c\u8d64\u3044\u30c6\u30ad\u30b9\u30c8\u306b\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u300d\u3092\u4f5c\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>Vue.directive('<strong>red<\/strong>', {\r\n    bind: function (el) {\r\n        el.style.color = 'red';\r\n    }\r\n});<\/pre>\n<p>Vue.directive \u306b\u72ec\u81ea\u306e\u540d\u524d\u300cred\u300d\u3092\u6307\u5b9a\u3057\u3001\u6700\u521d\u306b\u547c\u3070\u308c\u305f\u3068\u304d\u3060\u3051\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3067\u8d64\u8272\u3092\u9069\u7528\u3055\u305b\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u3001\u4ed6\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3068\u540c\u69d8\u3001\u300c<strong>v-<\/strong>\u300d\u3092\u3064\u3051\u3066\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;div <strong>v-red<\/strong>&gt;\u8d64\u6587\u5b57&lt;\/div&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-544\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-8.png\" alt=\"\" width=\"68\" height=\"33\" \/><\/p>\n<p>\u3053\u308c\u3092\u5fdc\u7528\u3059\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3044\u304f\u3064\u3082\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u91cd\u306d\u3066\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>Vue.directive('<strong>red<\/strong>', {\r\n    bind: function (el) {\r\n        el.style.color = 'red';\r\n    }\r\n});\r\nVue.directive('<strong>bold<\/strong>', {\r\n    bind: function (el) {\r\n        el.style.fontWeight = 'bold';\r\n    }\r\n});<\/pre>\n<pre>&lt;div <strong>v-red v-bold<\/strong>&gt;\u8d64\u6587\u5b57\u3067\u3001\u592a\u6587\u5b57&lt;\/div&gt;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-545\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-9.png\" alt=\"\" width=\"153\" height=\"40\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-9.png 153w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/l56-test-vue_directives-9-150x40.png 150w\" sizes=\"auto, (max-width: 153px) 100vw, 153px\" \/><\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306fVue\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u6614\u306f\u3001\u5bb6\u5ead\u306b\u3042\u308bIT\u6a5f\u5668\u304c\u305d\u3053\u307e\u3067\u30d1\u30ef\u30d5\u30eb\u3067\u306f\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u3042\u307e\u308aJavaScript\u3060\u3051\u3067\u6761\u4ef6\u5206\u5c90\u306a\u3069\u3092\u3059\u308b\u3079\u304d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3051\u3069\u3001\u4eca\u306e\u30de\u30b7\u30fc\u30f3\u306f\u683c\u5b89\u306e\u30b9\u30de\u30db\u3067\u3055\u3048\u4e00\u6614\u524d\u306e\u30d1\u30bd\u30b3\u30f3\u3088\u308a\u306f\u308b\u304b\u306b\u9ad8\u6027\u80fd\u306a\u3082\u306e\u3070\u304b\u308a\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002\u306a\u306e\u3067\u3001\u300c\u3067\u304d\u308b\u3060\u3051JavaScript\u3092\u4f7f\u3063\u3066\u5404\u30de\u30b7\u30fc\u30f3\u3067\u8a08\u7b97\u3092\u3057\u3066\u3082\u3089\u3046\u300d\u3068\u3044\u3046\u306e\u304c\u3001\u6642\u4ee3\u306e\u6d41\u308c\u306a\u306e\u304b\u306a\u30fc\u3001\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u958b\u767a\u306bVue\u3092\u6d3b\u7528\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-418 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/35.png\" alt=\"\" width=\"370\" height=\"240\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/35.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/35-300x195.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u00a0Vue component\u3067\u6c17\u3092\u3064\u3051\u308b\u3079\u304d\u3053\u3068\uff01\u3068\u3044\u3046\u8a18\u4e8b\u3092\u6295\u7a3f\u3057\u307e\u3057\u305f\u3051\u3069\u3001\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u3044\u308b\u6700\u4e2d\u306b\u3075\u3068\u601d\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u305d\u308c\u304c\u3001\u300c\u305d &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=530\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Vue.js\u3001\u516813\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u5b9f\u4f8b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":549,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,12],"tags":[69],"class_list":["post-530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-vue-js","tag-69"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/530","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=530"}],"version-history":[{"count":7,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/530\/revisions"}],"predecessor-version":[{"id":548,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/530\/revisions\/548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/549"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}