{"id":4882,"date":"2019-11-06T03:41:52","date_gmt":"2019-11-05T18:41:52","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4882"},"modified":"2019-11-06T03:41:52","modified_gmt":"2019-11-05T18:41:52","slug":"%e3%81%a8%e3%81%a3%e3%81%a6%e3%82%82%e7%b0%a1%e5%8d%98%ef%bc%81vue%e3%81%a7%e3%83%95%e3%83%ab%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e6%a9%9f%e8%83%bd%e3%82%92%e5%ae%9f%e8%a3%85%e3%81%99","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4882","title":{"rendered":"\u3068\u3063\u3066\u3082\u7c21\u5358\uff01Vue\u3067\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306f<code>Vue<\/code>\u3067\u3069\u308c\u3050\u3089\u3044\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u958b\u767a\u304c\u697d\u306b\u306a\u308b\u304b\u3092\u77e5\u3063\u3066\u3082\u3089\u3046\u3068\u3044\u3046\u76ee\u7684\u3067\u3001<a href=\"https:\/\/blog.capilano-fw.com\/?p=4867\">Vue\u306a\u3089\u8907\u6570\u30da\u30fc\u30b8\u306e\u5165\u529b\u3082\u305f\u3063\u305f\uff11\u30d5\u30a1\u30a4\u30eb\u3067\u958b\u767a\u3067\u304d\u308b\uff01<\/a>\u3068\u3044\u3046\u8a18\u4e8b\u3092\u304a\u5c4a\u3051\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u306f\u305d\u306e\u6d41\u308c\u3092\u53d7\u3051\u3066<strong>\u300cVue\u306a\u3089\u3053\u3093\u306a\u3053\u3068\u3082\u3067\u304d\u307e\u3059\uff01\u300d<\/strong>\u3068\u3044\u3046\u4f4d\u7f6e\u3065\u3051\u3067\u8a18\u4e8b\u3092\u304a\u5c4a\u3051\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u305d\u306e\u5177\u4f53\u7684\u306a\u6a5f\u80fd\u5185\u5bb9\u306f\u3068\u3044\u3046\u3068\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u753b\u50cf\u306e\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u753b\u50cf\u304c\u4e00\u89a7\u8868\u793a\u3055\u308c\u3066\u3044\u3066\u3001\u305d\u306e\u3046\u3061\uff11\u3064\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u753b\u9762\u3044\u3063\u3071\u3044\u306b\u8868\u793a\u3055\u308c\u308b\u3068\u3044\u3046\u6a5f\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u3055\u3089\u306b\u3001\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a\u3057\u3066\u3044\u308b\u6642\u306f<span style=\"font-size: 1rem;\">\u300c\u6b21\u3078\u300d\u300c\u524d\u3078\u300d\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3057\u3001\u9806\u756a\u306b\u753b\u50cf\u304c\u5207\u308a\u66ff\u308f\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u304d\u3063\u3068\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3001<code>Vue<\/code>\u3092\u4f7f\u3063\u3066\u753b\u50cf\u3092\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\uff08\u6700\u5f8c\u306b\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff09<\/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-2035 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/blurred_4.png\" alt=\"\" width=\"320\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/blurred_4.png 320w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/blurred_4-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/blurred_4-300x300.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/blurred_4-100x100.png 100w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Vue 2.6<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u307e\u305a\u306f\u3084\u308a\u305f\u3044\u3053\u3068\u3092\u307e\u3068\u3081\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u4e00\u89a7\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u753b\u50cf\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a\u3059\u308b<\/li>\n<li>\u753b\u50cf\u306f\u7e26\u6a2a\u3069\u3061\u3089\u304c\u9577\u304f\u3066\u3082\u4e2d\u592e\u306b\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/li>\n<li>\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u30fb\u30e2\u30fc\u30c9\u306e\u3068\u304d\u306f\u300c\u6b21\u3078\u300d\u300c\u524d\u3078\u300d\u30dc\u30bf\u30f3\u3067\u753b\u50cf\u304c\u9806\u756a\u306b\u5207\u308a\u66ff\u308f\u308b<\/li>\n<li>\u540c\u3058\u304f\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u30fb\u30e2\u30fc\u30c9\u306e\u6642\u306f\u300c\u9589\u3058\u308b\u300d\u30dc\u30bf\u30f3\u3067\u5143\u306b\u623b\u308c\u308b\u3088\u3046\u306b\u3059\u308b<\/li>\n<\/ul>\n<p>\u3067\u306f\u9806\u3092\u8ffd\u3063\u3066\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<h1>\u753b\u50cf\u3092\u4e00\u89a7\u8868\u793a\u3059\u308b<\/h1>\n<p>\u3067\u306f\u307e\u305a\u306f\u753b\u50cf\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306f<code>Bootstrap 4<\/code>\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u4f7f\u3063\u3066<code>500 \u00d7 500 px<\/code>\u306e\u753b\u50cf\u309210\u679a\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div id=\"app\" class=\"p-3\"&gt;\r\n        &lt;h1 class=\"mb-4\"&gt;Vue\u3067\u753b\u50cf\u3092\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a &amp;#x1F60A;&lt;\/h1&gt;\r\n        &lt;!-- \u753b\u50cf\u30ae\u30e3\u30e9\u30ea\u30fc --&gt;\r\n        &lt;div class=\"row\"&gt;\r\n            <strong>&lt;div class=\"col-md-2 text-center\" v-for=\"(url,index) in imageUrls\"&gt;<\/strong>\r\n<strong>                &lt;a href=\"#\"&gt;<\/strong>\r\n<strong>                    &lt;img :src=\"url\" class=\"img-fluid mb-3\"&gt;<\/strong>\r\n<strong>                &lt;\/a&gt;<\/strong>\r\n<strong>            &lt;\/div&gt;<\/strong>\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.0\"&gt;&lt;\/script&gt;\r\n    &lt;script&gt;\r\n\r\n        new Vue({\r\n            el: '#app',\r\n            data: {\r\n                <strong>imageUrls: [<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-1',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-2',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-3',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-4',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-5',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-6',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-7',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-8',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-9',<\/strong>\r\n<strong>                    'https:\/\/via.placeholder.com\/500\/FFCCCC\/550000?text=Image-10',<\/strong>\r\n<strong>                ]<\/strong>\r\n            }\r\n        });\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3053\u3053\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u8868\u793a\u3059\u308b\u753b\u50cf\u306eURL\u3092\u914d\u5217\u306b\u5165\u308c\u3066\u304a\u304d<code>v-for<\/code>\u3092\u4f7f\u3063\u3066\u305d\u308c\u3089\u3092<code>&lt;img&gt;<\/code>\u30bf\u30b0\u306b\u9069\u7528\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4883\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/11\/vue_image_fullscreen_1.png\" alt=\"\" width=\"789\" height=\"316\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/11\/vue_image_fullscreen_1.png 789w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/11\/vue_image_fullscreen_1-300x120.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/11\/vue_image_fullscreen_1-768x308.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<h1>\u753b\u50cf\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u306e\u30af\u30ea\u30c3\u30af\u30fb\u30a4\u30d9\u30f3\u30c8\u3092\u7528\u610f\u3059\u308b<\/h1>\n<p>\u3067\u306f\u6b21\u306b\u3001\u3053\u308c\u3089\u306e\u753b\u50cf\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u5b9f\u884c\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306fHTML\u5074\u306b\u30a4\u30d9\u30f3\u30c8\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\uff08<code>index<\/code>\u306f<code>v-for<\/code>\u306e<code>index<\/code>\u3001\u3064\u307e\u308a\u753b\u50cf\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n<pre>&lt;a href=\"#\" <strong>@click.prevent=\"onImageClick(index)\"<\/strong>&gt;\r\n    &lt;img :src=\"url\" class=\"img-fluid mb-3\"&gt;\r\n&lt;\/a&gt;<\/pre>\n<p>\u203b \u3061\u306a\u307f\u306b\u3001<code>prevent<\/code>\u3092\u3064\u3051\u308b\u3068\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u30a2\u30c9\u30ec\u30b9\u304c<code>#<\/code>\u306b\u79fb\u52d5\u3059\u308b\u3053\u3068\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001<code>JavaScript<\/code>\u5074\u3067\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n\r\n        \/\/ \u7701\u7565\r\n\r\n        <strong>currentImageIndex: -1,<\/strong>\r\n    },\r\n    methods: {\r\n        <strong>onImageClick(index) {<\/strong>\r\n\r\n<strong>            this.currentImageIndex = index;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n    },\r\n});<\/pre>\n<p>\u3053\u3053\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u300c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u753b\u50cf\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u4fdd\u6301\u3057\u3066\u304a\u304f\u300d\u3060\u3051\u3067\u3059\u3002<\/p>\n<h1>\u9078\u629e\u3055\u308c\u305f\u753b\u50cf\u306eURL\u304c\u53d6\u5f97\u3067\u304d\u308b\u7591\u4f3c\u5909\u6570\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4fdd\u6301\u3057\u3066\u308b\u753b\u50cf\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u4f7f\u3063\u3066\u3001\u305d\u306eURL\u304c\u53d6\u5f97\u3067\u304d\u308b\u7591\u4f3c\u5909\u6570<code>currentImageUrl<\/code>\u3092\u3064\u304f\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>new Vue({\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    computed: {\r\n        <strong>currentImageUrl() {<\/strong>\r\n\r\n<strong>            return this.imageUrls[this.currentImageIndex];<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3053\u308c\u3067<code>Vue<\/code>\u5185\u306a\u3089<code>this.currentImageUrl<\/code>\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u3067\u306f<code>currentImageUrl<\/code>\u3068\u3059\u308c\u3070\u3001\u73fe\u5728\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u753b\u50cf\u306eURL\u304c\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a\u3059\u308b\u753b\u50cf\u306eURL\u304c\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u30e1\u30a4\u30f3\u306e\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u90e8\u5206\u3092\u3064\u304f\u3063\u3066\u3044\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306fCSS\u90e8\u5206\u3067\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n\r\n    &lt;!-- \u7701\u7565 --&gt;\r\n\r\n    <strong>&lt;style&gt;<\/strong>\r\n\r\n<strong>        #fullscreen {<\/strong>\r\n\r\n<strong>            position: fixed;<\/strong>\r\n<strong>            top: 0;<\/strong>\r\n<strong>            left: 0;<\/strong>\r\n<strong>            width: 100%;<\/strong>\r\n<strong>            height: 100%;<\/strong>\r\n<strong>            background: #000;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        #fullscreen img {<\/strong>\r\n\r\n<strong>            position: fixed;<\/strong>\r\n<strong>            top: 0;<\/strong>\r\n<strong>            bottom: 0;<\/strong>\r\n<strong>            left: 0;<\/strong>\r\n<strong>            right: 0;<\/strong>\r\n<strong>            max-width: 100%;<\/strong>\r\n<strong>            max-height: 100%;<\/strong>\r\n<strong>            margin: auto;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    &lt;\/style&gt;<\/strong>\r\n&lt;\/head&gt;<\/pre>\n<p>\u3053\u3053\u3067\u91cd\u8981\u306a\u306e\u306f<code>position:absolute<\/code>\u3067\u306f\u306a\u304f\u3001<code>position:fixed<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3059\u3002\u306a\u305c\u306a\u3089\u30b9\u30af\u30ed\u30fc\u30eb\u3055\u308c\u308b\u307b\u3069\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u305f\u5834\u5408\u306b<code>fixed<\/code>\uff08\u753b\u9762\u306b\u56fa\u5b9a\uff09\u3067\u306a\u3044\u3068\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u304c\u305a\u308c\u3066\u3057\u307e\u3046\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001HTML\u90e8\u5206\u3067\u3059\u3002<\/p>\n<pre>&lt;div id=\"app\" class=\"p-3\"&gt;\r\n\r\n    &lt;!-- \u7701\u7565\uff08\u753b\u50cf\u306e\u4e00\u89a7\uff09 --&gt;\r\n\r\n    <strong>&lt;div id=\"fullscreen\" v-if=\"showFullscreen\"&gt;<\/strong>\r\n<strong>        &lt;button style=\"position:fixed;bottom:20px;left:20px;\" type=\"button\" class=\"btn btn-lg btn-info\" @click=\"toPrev\"&gt;\u524d\u3078&lt;\/button&gt;<\/strong>\r\n<strong>        &lt;button style=\"position:fixed;bottom:20px;right:20px;\" type=\"button\" class=\"btn btn-lg btn-info\" @click=\"toNext\"&gt;\u6b21\u3078&lt;\/button&gt;<\/strong>\r\n<strong>        &lt;button style=\"position:fixed;top:20px;right:20px;\" type=\"button\" class=\"btn btn-lg btn-outline-light\" @click=\"close\"&gt;\u9589\u3058\u308b&lt;\/button&gt;<\/strong>\r\n<strong>        &lt;img :src=\"currentImageUrl\"&gt;<\/strong>\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n&lt;\/div&gt;<\/pre>\n<p>\u3053\u3053\u3067\u5148\u307b\u3069\u306e<code>currentImageUrl<\/code>\u3092\u4f7f\u3044\u3001<strong>\u300c\u6b21\u3078\u300d\u300c\u524d\u3078\u300d<\/strong>\u305d\u3057\u3066\u3001<strong>\u300c\u9589\u3058\u308b\u300d<\/strong>\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001<code>v-if<\/code>\u3067\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u306e\u8868\u793a\u304c\u5207\u308a\u66ff\u308f\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u90e8\u5206\u306b\u3082\u6ce8\u76ee\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n\r\n        \/\/ \u7701\u7565\r\n\r\n<strong>        showFullscreen: false <\/strong>\/\/ \u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u306e\u8868\u793a\u5207\u308a\u66ff\u3048\r\n    },\r\n    methods: {\r\n        onImageClick(index) {\r\n\r\n            this.currentImageIndex = index;\r\n            <strong>this.showFullscreen = true;<\/strong> \/\/ \u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u3092\u8868\u793a\u3059\u308b\r\n\r\n        },\r\n        toNext() {\r\n\r\n            this.currentImageIndex++;\r\n\r\n            if(this.imageUrls[this.currentImageIndex] === undefined) {\r\n\r\n                this.currentImageIndex = 0;\r\n\r\n            }\r\n\r\n        },\r\n        toPrev() {\r\n\r\n            this.currentImageIndex--;\r\n\r\n            if(this.currentImageIndex &lt; 0) {\r\n\r\n                this.currentImageIndex = this.imageUrls.length - 1;\r\n\r\n            }\r\n\r\n        },\r\n        close() {\r\n\r\n            <strong>this.showFullscreen = false; <\/strong>\/\/ \u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u3092\u8868\u793a\u3059\u308b\r\n\r\n        }\r\n    },\r\n    computed: {\r\n        currentImageUrl() {\r\n\r\n            return this.imageUrls[this.currentImageIndex];\r\n\r\n        }\r\n    }\r\n});<\/pre>\n<p>\u307e\u305a\u3001\u3053\u3053\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u306e\u8868\u793a\uff0f\u975e\u8868\u793a\u306e\u5207\u308a\u66ff\u3048\u3067\u3059\u3002<\/p>\n<p>\u3068\u306f\u3044\u3063\u3066\u3082\u3001\u5148\u307b\u3069\u306eHTML\u5074\u3067\u8a2d\u5b9a\u3057\u305f<code>v-if<\/code>\u304c\u5168\u3066\u3084\u3063\u3066\u304f\u308c\u308b\u306e\u3067\u5f8c\u306f\u3001<code>showFullscreen<\/code>\u306e\u4e2d\u8eab\u3092<code>true \/ false<\/code>\u306b\u5207\u308a\u66ff\u3048\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u5207\u308a\u66ff\u3048\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u753b\u50cf\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u304d\u306e<code>onImageClick()<\/code>\u3068\u3001\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u3092\u7d42\u4e86\u3059\u308b\u3068\u304d\u306e<code>close()<\/code>\uff12\u30f6\u6240\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u753b\u50cf\u3092\u9806\u306b\u6b21\u3005\u3092\u5207\u308a\u66ff\u3048\u3066\u3044\u308b\u306e\u306f<code>toNext()<\/code>\u3068<code>toPrev()<\/code>\u3067\u3001\u3053\u3053\u3067\u306f<code>currentImageIndex<\/code>\u3001\u3064\u307e\u308a\u9078\u629e\u3055\u308c\u305f\u753b\u50cf\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u8db3\u3057\u305f\u308a\u3001\u5f15\u3044\u305f\u308a\u3057\u3066\u4e2d\u8eab\u3092\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u72b6\u6cc1\u306b\u3088\u3063\u3066\u306f\u65b0\u3057\u3044\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u304c\u5b58\u5728\u3057\u306a\u3044\uff08\u305f\u3068\u3048\u3070<code>-1<\/code>\u306a\u3069\uff09\u5834\u5408\u304c\u51fa\u3066\u304f\u308b\u306e\u3067\u3001\u305d\u306e\u5834\u5408\u306f\u300c\u4e00\u5468\u3050\u308b\u3063\u3068\u56de\u3063\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u300d\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><code>currentImageIndex<\/code>\u306f\u3001\u5148\u307b\u3069\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u306e<code>&lt;img&gt;<\/code>\u30bf\u30b0\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u756a\u53f7\u304c\u5909\u66f4\u306b\u306a\u308b\u3054\u3068\u306b\u65b0\u3057\u3044\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3044\u3064\u3082\u306e\u3088\u3046\u306b\u4eca\u56de\u958b\u767a\u3057\u305f\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>\u203b \u306a\u304a\u3001\u7e26\u6a2a\u3069\u3061\u3089\u304c\u9577\u304f\u3066\u3082\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u8868\u793a\u3067\u304d\u308b\u306e\u3092\u30c1\u30a7\u30c3\u30af\u3057\u305f\u3044\u306e\u3067\u3001\u308f\u3056\u3068\uff12\u3064\u306e\u753b\u50cf\u306f\u9577\u65b9\u5f62\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><iframe loading=\"lazy\" title=\"Vue\u3067\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u305f\u30b5\u30f3\u30d7\u30eb\" width=\"525\" height=\"394\" src=\"https:\/\/www.youtube.com\/embed\/McMneRowTK0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>\u306f\u3044\uff01\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<h1>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b CSS, JavaScript, \u753b\u50cf\u5168\u3066<code>CDN<\/code>\u3092\u901a\u3057\u3066\u547c\u3073\u51fa\u3057\u3066\u3044\u308b\u306e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3057\u305f\u3089\u3059\u3050\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=4886&amp;tmstv=1777533754\" rel=\"nofollow\" id=\"download-link-4886\" data-redirect=\"false\" >\n\tVue\u3067\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b<\/a>\n\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u3082\u3088\u308a<code>Vue<\/code>\u306e\u4fbf\u5229\u3055\u3092\u77e5\u3063\u3066\u3082\u3089\u3046\u305f\u3081\u306b\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u524d\u56de\u3082\u4eca\u56de\u3082\u3067\u3059\u304c\u3001<code>Vue<\/code>\u306e<code>v-if<\/code>\u3092\u4f7f\u3048\u3070\u3001\u7c21\u5358\u306b\u8868\u793a\uff0f\u975e\u8868\u793a\u306e\u5207\u308a\u66ff\u3048\u304c\u3067\u304d\u308b\u306e\u304c\u308f\u304b\u3063\u3066\u3044\u305f\u3060\u3051\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u4eca\u56de\u306f\u753b\u50cf\u3092\u4f7f\u3044\u307e\u3057\u305f\u304c\u3001\u5b9f\u306f\u3053\u308c\u306f\u81ea\u524d\u3067\u7528\u610f\u3057\u305f\u3082\u306e\u3067\u306f\u306a\u304f\u3001<a href=\"http:\/\/placeholder.com\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/placeholder.com\/<\/a> \u3068\u3044\u3046\u30a6\u30a7\u30d6\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u306f\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u3001\u7e26\u6a2a\u30b5\u30a4\u30ba\u306a\u3069\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5165\u3063\u305fURL\u3092\u6307\u5b9a\u3060\u3051\u3067\u305d\u306e\u307e\u307e\u753b\u50cf\u304c\u4f7f\u3048\u308b\u3068\u3044\u3046\u3001\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u306f\u5fc3\u304b\u3089\u3042\u308a\u304c\u305f\u3044\u30b5\u30fc\u30d3\u30b9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\uff08\u305d\u306e\u305f\u3081\u3001\u30c7\u30b6\u30a4\u30ca\u30fc\u3055\u3093\u304b\u3089HTML\u30d5\u30a1\u30a4\u30eb\u3092\u3082\u3089\u3046\u3068<code>placeholder.com<\/code>\u306e\u753b\u50cf\u304c\u57cb\u3081\u8fbc\u307e\u308c\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\uff09<\/p>\n<p>\u3057\u304b\u3082\u3001\u82f1\u8a9e\u3060\u3051\u3067\u3059\u304c\u30c6\u30ad\u30b9\u30c8\u3082\u5909\u66f4\u3067\u304d\u307e\u3059\u3057\u8272\u3082\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305c\u3072\u7686\u3055\u3093\u3082\u8208\u5473\u304c\u3042\u3063\u305f\u3089\u4f7f\u3063\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-417 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/9.png\" alt=\"\" width=\"370\" height=\"220\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/9-300x178.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306fVue\u3067\u3069\u308c\u3050\u3089\u3044\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u958b\u767a\u304c\u697d\u306b\u306a\u308b\u304b\u3092\u77e5\u3063\u3066\u3082\u3089\u3046\u3068\u3044\u3046\u76ee\u7684\u3067\u3001Vue\u306a\u3089\u8907\u6570\u30da\u30fc\u30b8\u306e\u5165\u529b\u3082\u305f\u3063\u305f\uff11\u30d5\u30a1\u30a4\u30eb\u3067\u958b\u767a\u3067\u304d\u308b\uff01\u3068\u3044\u3046\u8a18\u4e8b &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4882\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3068\u3063\u3066\u3082\u7c21\u5358\uff01Vue\u3067\u30d5\u30eb\u30b9\u30af\u30ea\u30fc\u30f3\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4891,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[182],"class_list":["post-4882","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vue-js","tag-182"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4882","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=4882"}],"version-history":[{"count":4,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4882\/revisions"}],"predecessor-version":[{"id":4890,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4882\/revisions\/4890"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4891"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}