{"id":6010,"date":"2018-07-17T22:18:05","date_gmt":"2018-07-17T13:18:05","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=6010"},"modified":"2023-05-28T00:02:02","modified_gmt":"2023-05-27T15:02:02","slug":"%e3%80%90vue-js%e3%80%91%e3%80%8c%e3%83%88%e3%83%a9%e3%82%b8%e3%82%b7%e3%83%a7%e3%83%b3%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=6010","title":{"rendered":"\u3010Vue.js\u3011\u300c\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u300d\u306b\u3064\u3044\u3066"},"content":{"rendered":"<h2>\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3068\u306f\uff1f<\/h2>\n<p>CSS\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3060\u3063\u305f\u308a\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u3088\u308a\u7c21\u5358\u306b\u4f7f\u3044\u3084\u3059\u304f\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u3067\u3059\u3002\u8981\u7d20\u304cDOM\u306b\u8ffd\u52a0\u524a\u9664\u3055\u308c\u305f\u308a\u3057\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3001\u30b9\u30bf\u30a4\u30eb\u3092\u9069\u7528\u3057\u307e\u3059\u3002<\/p>\n<h2>\u4f7f\u3044\u65b9<\/h2>\n<p>\u300c&lt;transition&gt;\u300d\u30bf\u30b0(transition\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8)\u3067\u56f2\u3080\u3060\u3051\u3067\u3059\u3002\u8ffd\u52a0\u3059\u308b\u969b\u306f\u300center\u300d\u3001\u524a\u9664\u3059\u308b\u969b\u306f\u300cleave\u300d\u3068\u3044\u3046\u6587\u5b57\u3092\u542b\u3093\u3060\u30af\u30e9\u30b9\u304c\u3001\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3068\u3057\u3066\u305d\u306e\u8981\u7d20\u306b\u4ed8\u52a0\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u306e\u7a2e\u985e<\/h2>\n<p>\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u306b\u306f\u4e0b\u8a18\u306e\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u5358\u4e00\u8981\u7d20\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3<\/li>\n<li>\u30ea\u30b9\u30c8\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3<\/li>\n<\/ul>\n<h3>\u5358\u4e00\u8981\u7d20\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3<\/h3>\n<p>\u300c&lt;transition&gt;\u300d\u30bf\u30b0\u306e\u4e2d\u306b\u30011\u3064\u3060\u3051\u8981\u7d20\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306b\u4f7f\u7528\u3067\u304d\u308b\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3067\u3059\u3002v-if\u3001v-show\u7b49\u306e\u63cf\u753b\u5207\u308a\u66ff\u3048\u3001\u52d5\u7684\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u7b49\u304c\u8a72\u5f53\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30ea\u30b9\u30c8\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3<\/h3>\n<p>\u8907\u6570\u8981\u7d20\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3057\u3066\u3001\u8ffd\u52a0\u3001\u524a\u9664\u3001\u79fb\u52d5\u7b49\u3092\u884c\u3046\u5834\u5408\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002v-for\u7b49\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u3053\u308c\u304c\u8a72\u5f53\u3057\u307e\u3059\u3002<\/p>\n<h2>\u5b9f\u88c5<\/h2>\n<h3>6\u3064\u306e\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u30af\u30e9\u30b9<\/h3>\n<p>transition\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5b9f\u88c5\u3059\u308b\u969b\u306f\u4e0b\u8a186\u3064\u306e\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002(fade-enter\u7b49)<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u30af\u30e9\u30b9<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>{name\u5c5e\u6027\u306e\u5024}-enter<\/td>\n<td>\u73fe\u308c\u308b\u6642\u306e\u6700\u521d\u306e\u72b6\u614b<\/td>\n<\/tr>\n<tr>\n<td>{name\u5c5e\u6027\u306e\u5024}-enter-active<\/td>\n<td>\u73fe\u308c\u308b\u6642\u306e\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u306e\u72b6\u614b<\/td>\n<\/tr>\n<tr>\n<td>{name\u5c5e\u6027\u306e\u5024}-enter-to<\/td>\n<td>\u73fe\u308c\u308b\u6642\u306e\u6700\u5f8c\u306e\u72b6\u614b<\/td>\n<\/tr>\n<tr>\n<td>{name\u5c5e\u6027\u306e\u5024}-leave<\/td>\n<td>\u6d88\u3048\u308b\u6642\u306e\u6700\u521d\u306e\u72b6\u614b<\/td>\n<\/tr>\n<tr>\n<td>{name\u5c5e\u6027\u306e\u5024}-leave-active<\/td>\n<td>\u6d88\u3048\u308b\u6642\u306e\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u306e\u72b6\u614b<\/td>\n<\/tr>\n<tr>\n<td>{name\u5c5e\u6027\u306e\u5024}-leave-to<\/td>\n<td>\u00a0\u6d88\u3048\u308b\u6642\u306e\u6700\u5f8c\u306e\u72b6\u614b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u8868\u793a\u306e\u52d5\u304d<\/h4>\n<p>\u8868\u793a\u3055\u305b\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u306fenter\u3068enter-active\u304ctransition\u3067\u56f2\u3093\u3060\u7b87\u6240\u306b\u4ed8\u52a0\u3055\u308c\u307e\u3059\u3002\u305d\u3057\u3066\u3059\u3050\u306benter\u3092\u524a\u9664\u3057\u3066\u3001enter-to\u3092\u4ed8\u52a0\u3057\u307e\u3059\u3002\u6700\u7d42\u7684\u306benter-to\u3068enter-active\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<p>enter\u306f\u6700\u521d\u306e1\u30d5\u30ec\u30fc\u30e0\u3057\u304b\u4ed8\u52a0\u3055\u308c\u306a\u3044\u306e\u3067\u307b\u3068\u3093\u3069\u8a8d\u8b58\u3059\u308b\u306e\u306f\u96e3\u3057\u3044\u3067\u3059\u3002<\/p>\n<h4>\u975e\u8868\u793a\u306e\u52d5\u304d<\/h4>\n<p>\u8868\u793a\u3055\u305b\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u306fleave\u3068leave-active\u304ctransition\u3067\u56f2\u3093\u3060\u7b87\u6240\u306b\u4ed8\u52a0\u3055\u308c\u307e\u3059\u3002\u305d\u3057\u3066\u3059\u3050\u306bleave\u3092\u524a\u9664\u3057\u3066\u3001leave-to\u3092\u4ed8\u52a0\u3057\u307e\u3059\u3002\u6700\u7d42\u7684\u306bleave-to\u3068leave-active\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30bd\u30fc\u30b9\u4f8b<\/h3>\n<p><span style=\"color: #ff0000;\"><strong>\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u969b\u306b\u3001\u3086\u3063\u304f\u308a\u8868\u793a\u3055\u308c\u3066\u3001\u3086\u3063\u304f\u308a\u975e\u8868\u793a\u306b\u3055\u305b\u308b\u4f8b<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h4>template<\/h4>\n<p>transition\u306b\u3064\u3051\u308b<span style=\"color: #ff0000;\"><strong>name\u306f\u7701\u7565\u3057\u305f\u5834\u5408\u306fv\u3068\u8a00\u3046\u5024\u304c\u81ea\u52d5\u3067\u4ed8\u52a0\u3055\u308c\u307e\u3059\u304c\u3001\u57fa\u672c\u7684\u306b\u306f\u547d\u540d\u3059\u308b<\/strong><\/span>\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true\">\u00a0   &lt;button @click=\"show = !show\"&gt;\u5207\u308a\u66ff\u3048&lt;\/button&gt;\r\n    &lt;transition name=\"fade\"&gt;\r\n      &lt;p v-if=\"show\"&gt;\u30c6\u30b9\u30c8&lt;\/p&gt;\r\n    &lt;\/transition&gt;<\/pre>\n<h4>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h4>\n<p>v-if\u3067\u8868\u793a\u975e\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306e\u5909\u6570\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">  data() {\r\n    return {\r\n      show: true\r\n    }\r\n  }<\/pre>\n<h4>CSS<\/h4>\n<pre class=\"lang:default decode:true\">.fade-enter{\r\n  opacity: 0;\r\n}\r\n.fade-enter-active{\r\n   transition: opacity 3s; \r\n}\r\n.fade-enter-to{\r\n  opacity: 1;\r\n}\r\n.fade-leave{\r\n  opacity: 1;\r\n}\r\n.fade-leave-active{\r\n   transition: opacity 3s; \r\n}\r\n.fade-leave-to{\r\n  opacity: 0;\r\n}<\/pre>\n<h2>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u88c5<\/h2>\n<p>CSS\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u5834\u5408\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<h3>template<\/h3>\n<pre class=\"lang:default decode:true\">    &lt;transition name=\"slide\"&gt;\r\n      &lt;p v-if=\"show\"&gt;anime&lt;\/p&gt;\r\n    &lt;\/transition&gt;<\/pre>\n<h3>css<\/h3>\n<pre class=\"lang:default decode:true\">.slide-enter-active{\r\n   animation: slide-in 3s; \r\n}\r\n\r\n.slide-leave-active{\r\n   animation: slide-in 3s reverse; \r\n}\r\n\r\n@keyframes slide-in {\r\n  from {\r\n    transform: translateX(100px);\r\n  }\r\n\r\n  to {\r\n    transform: translateX(0);\r\n  }\r\n}<\/pre>\n<h2>\u305d\u306e\u4ed6\u5c5e\u6027\u306e\u4f7f\u3044\u9053<\/h2>\n<h3>type\u5c5e\u6027<\/h3>\n<p>\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3068\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306fCSS\u306e\u306a\u304b\u306b\u305d\u308c\u305e\u308c\u8a18\u8ff0\u3059\u308c\u3070\u3069\u3061\u3089\u3082\u9069\u7528\u3055\u305b\u308b\u4e8b\u304c\u53ef\u80fd\u3067\u3059\u3002\u9577\u3044\u79d2\u6570\u306e\u65b9\u3092\u57fa\u6e96\u3068\u3057\u3066\u63cf\u753b\u304c\u884c\u308f\u308c\u307e\u3059\u3002\u660e\u793a\u7684\u306b\u3069\u3061\u3089\u3092DOM\u63cf\u753b\u306e\u7d42\u4e86\u306e\u57fa\u6e96\u3068\u3057\u3066\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f<span style=\"color: #ff0000;\"><strong>type\u5c5e\u6027\u3092transition\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u6307\u5b9a<\/strong><\/span>\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">    &lt;transition name=\"\u540d\u524d\" type=\"animation\"&gt;\r\n      &lt;p v-if=\"show\"&gt;anime\u3068\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3&lt;\/p&gt;\r\n    &lt;\/transition&gt;<\/pre>\n<h3>apper\u5c5e\u6027<\/h3>\n<p>\u6700\u521d\u306e\u521d\u671f\u63cf\u753b\u6642\u306b\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3084\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u4e8b\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h2>\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u30d5\u30c3\u30af<\/h2>\n<p>JavaScript\u3092\u7528\u3044\u305f\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u64cd\u4f5c\u3092\u884c\u3046\u5834\u5408\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3068\u306f\uff1f CSS\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u3060\u3063\u305f\u308a\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u3088\u308a\u7c21\u5358\u306b\u4f7f\u3044\u3084\u3059\u304f\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u3067\u3059\u3002\u8981\u7d20\u304cDOM\u306b\u8ffd\u52a0\u524a\u9664\u3055\u308c\u305f\u308a\u3057\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3001\u30b9\u30bf\u30a4\u30eb\u3092\u9069\u7528\u3057\u307e\u3059\u3002 \u4f7f\u3044\u65b9 \u300c&lt;transit [&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\/6010"}],"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=6010"}],"version-history":[{"count":15,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/6010\/revisions"}],"predecessor-version":[{"id":20635,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/6010\/revisions\/20635"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6010"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}