{"id":4675,"date":"2019-09-29T19:51:08","date_gmt":"2019-09-29T10:51:08","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4675"},"modified":"2019-09-30T18:51:16","modified_gmt":"2019-09-30T09:51:16","slug":"vue%e3%81%aa%e3%82%89%e7%b0%a1%e5%8d%98%ef%bc%81%e6%99%82%e3%83%bb%e5%88%86%e3%81%8c%e9%80%a3%e6%90%ba%e3%81%99%e3%82%8b%e6%99%82%e9%96%93%e5%85%a5%e5%8a%9b%e3%82%b3%e3%83%b3%e3%83%9d%e3%83%bc","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4675","title":{"rendered":"Vue\u306a\u3089\u7c21\u5358\uff01\u6642\u30fb\u5206\u304c\u9023\u643a\u3059\u308b\u6642\u9593\u5165\u529b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08DL\u53ef\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u308c\u306f\u4eca\u306b\u59cb\u307e\u3063\u305f\u308f\u3051\u3058\u3083\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3084\u306f\u308a\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u306b\u643a\u308f\u308b\u4eba\u9593\u3068\u3057\u3066\u3044\u3064\u3082\u5fc3\u639b\u3051\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u304c\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\uff08\u4f7f\u3044\u3084\u3059\u3055\uff09<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u30fb\u30fb\u30fb\u3068\u3044\u3046\u306e\u3082\u3001\u3044\u304b\u306b\u3044\u3044\u30b7\u30b9\u30c6\u30e0\u3067\u3082\u4f7f\u3046\u4eba\u304c\u300c\u3046\u30fc\u3093\u3001\u3053\u3053\u6bce\u56de\u3081\u3093\u3069\u304f\u3055\u3044\u306a\u30fc\u300d\u3068\u306a\u3063\u3066\u3057\u307e\u3046\u3068\u5c11\u3057\u305a\u3064\u4f7f\u3063\u3066\u3082\u3089\u3048\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u3001\u672c\u672b\u8ee2\u5012\u3068\u306a\u3053\u3068\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u304b\u3089\u3067\u3059\u3002\uff08\u3068\u306f\u3044\u3063\u3066\u3082\u30e6\u30fc\u30b6\u30fc\u3055\u3093\u306e\u6c17\u6301\u3061\u3092100\uff05\u7406\u89e3\u3059\u308b\u306e\u306f\u3068\u3066\u3082\u96e3\u3057\u3044\u3067\u3059\u3002\u305d\u308c\u305e\u308c\u597d\u307f\u3082\u3042\u308a\u307e\u3059\u3057\uff09<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u3042\u3044\u3060\u61f8\u6848\u306b\u306a\u3063\u305f\u306e\u304c<strong>\u300c\u6642\u9593\u306e\u5165\u529b\u30dc\u30c3\u30af\u30b9\u300d<\/strong>\u3067\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093<code>Google Chrome<\/code>\u306a\u3069\u3067\u306f<code>&lt;input type=\"time\"&gt;<\/code>\u3068\u3044\u3046\u6642\u9593\u5c02\u7528\u306e\u5165\u529b\u30dc\u30c3\u30af\u30b9\u3092\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u3067<code>0<\/code>\u304b\u3089\u3072\u3068\u3064\u305a\u3064\u6570\u5b57\u3092\u5909\u66f4\u3057\u305f\u308a\u3001\u30af\u30ea\u30c3\u30af\u3067\u30ab\u30c1\u30ab\u30c1\u3059\u308b\u306e\u304c\u7d50\u69cb\u3081\u3093\u3069\u3046\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u3059\u306d\uff08\u7279\u306b\u771f\u3093\u4e2d\u306e<code>30\u5206<\/code>\u306b\u79fb\u52d5\u3059\u308b\u306e\u306f\u306a\u304b\u306a\u304b\u306e\u30ed\u30f3\u30b0\u30b8\u30e3\u30fc\u30cb\u30fc\u3067\u3059\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4676\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_1.png\" alt=\"\" width=\"308\" height=\"78\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_1.png 308w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_1-300x76.png 300w\" sizes=\"auto, (max-width: 308px) 100vw, 308px\" \/><\/p>\n<p>\u203b \u3082\u3061\u308d\u3093\u30ad\u30fc\u30dc\u30fc\u30c9\u5165\u529b\u3067\u304d\u307e\u3059\u304c\u3001\u3067\u304d\u308b\u3060\u3051\u30de\u30a6\u30b9 \u21d4 \u30ad\u30fc\u30dc\u30fc\u30c9\u306e\u52d5\u4f5c\u3092\u6e1b\u3089\u3059\u306e\u3082\u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\u3068\u8003\u3048\u3066\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3053\u306e\u3081\u3093\u3069\u304f\u3055\u3055\u3092\u89e3\u6d88\u3059\u3079\u304f\u3001<code>Vue<\/code>\u3067\u300c\u6642\u30fb\u5206\u300d\uff12\u3064\u306e\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u3092\u4e26\u3079\u3001\u30de\u30a6\u30b9\u30af\u30ea\u30c3\u30af\u3060\u3051\u3067\u6642\u9593\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<\/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-2158 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/29.png\" alt=\"\" width=\"170\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/29.png 170w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/29-159x300.png 159w\" sizes=\"auto, (max-width: 170px) 100vw, 170px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Vue 2.6<\/p>\n<h1>\u6642\u30fb\u5206\u3092\u5165\u529b\u3059\u308bVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h1>\n<p>\u3067\u306f\u4eca\u56de\u306f\u3001\u3069\u3061\u3089\u304b\u3068\u3044\u3048\u3070<code>Vue<\/code>\u306e\u57fa\u672c\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af\u3092\u5fdc\u7528\u3057\u305f\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u9806\u3092\u8ffd\u3063\u3066\u8aac\u660e\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>Vue\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>\u307e\u305a\u306f<code>Vue<\/code>\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u6e96\u5099\u3057\u307e\u3059\u3002<\/p>\n<p><code>npm<\/code>\u306a\u3069\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30fb\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3092\u4f7f\u3046\u3068\u3044\u308d\u3044\u308d\u3068\u3081\u3093\u3069\u304f\u3055\u3044\u4f5c\u696d\u304c\u3042\u308b\u306e\u3067\u4eca\u56de\u306f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\uff08\u3044\u308f\u3086\u308b<code>cdn<\/code>\uff09\u3092\u901a\u3057\u3066\u8aad\u307f\u8fbc\u3080\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;!-- Tailwind --&gt;\r\n    &lt;link href=\"https:\/\/unpkg.com\/tailwindcss@^1.0\/dist\/tailwind.min.css\" rel=\"stylesheet\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div id=\"app\"&gt;\r\n\u3000\u3000\u3000\u3000\u3000&lt;!-- \u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059 --&gt;\r\n        <strong>&lt;v-hour-minute&gt;&lt;\/v-hour-minute&gt;<\/strong>\r\n    &lt;\/div&gt;\r\n    &lt;!-- Vue.js --&gt;\r\n    <strong>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.0\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>    &lt;script&gt;<\/strong>\r\n\r\n<strong>        new Vue({<\/strong>\r\n<strong>            el: '#app'<\/strong>\r\n<strong>        });<\/strong>\r\n\r\n<strong>    &lt;\/script&gt;<\/strong>\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u203b \u306a\u304a\u3001\u898b\u305f\u76ee\u3092\u5c11\u3057\u306f\u826f\u304f\u3057\u305f\u3044\u306e\u3067<code>Tailwind<\/code>\u3082<code>cdn<\/code>\u3067\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n<h2>\u300c\u6642\u30fb\u5206\u300d\u5165\u529b\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u672c\u4f53\u3092\u3064\u304f\u308b<\/h2>\n<h3>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u57fa\u672c\u3092\u3064\u304f\u308b<\/h3>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u672c\u4f53\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u306e\u3067\u3001\u307e\u305a\u57fa\u672c\u5f62\u3092\u3064\u304f\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>Vue.component(<strong>'v-hour-minute'<\/strong>, {\r\n    <strong>props: {<\/strong>\r\n<strong>        name: String,<\/strong>\r\n<strong>        value: String<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u307e\u305a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u540d\u306e\u6307\u5b9a\u3067\u3059\u3002<br \/>\n<span style=\"font-size: 1rem;\">\u3064\u307e\u308a\u3001\u5b9f\u969b\u306b\u3053\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f7f\u3046\u3068\u304d\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/span><\/p>\n<pre><strong>&lt;v-hour-minute&gt;&lt;\/v-hour-minute&gt;<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u6b21\u306b<code>props<\/code>\u3067<code>name<\/code>\u3068<code>value<\/code>\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u5b9f\u969b\u306b\u306f\u6b21\u306e\u3088\u3046\u306b\u3057\u3066\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;v-hour-minute\r\n    <strong>name=\"start_time\"<\/strong>\r\n    <strong>value=\"23:15\"<\/strong>&gt;\r\n&lt;\/v-hour-minute&gt;<\/pre>\n<p>\u203b \u306a\u305c<code>name<\/code>\u3092\u3064\u3051\u308b\u304b\u306f\u6b21\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u9805\u76ee\u3067\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h3>\n<p>\u3067\u306f\u7d9a\u3044\u3066\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u8868\u793a\u3059\u308b\u300c\u6642\u30fb\u5206\u300d\uff12\u3064\u306e\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u3068\u3001\u3053\u308c\u3089\u306e\u5024\u304c\u5165\u3063\u3066\u304f\u308b\u5909\u6570\u306e<code>hours<\/code>\u3001<code>minutes<\/code>\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<pre>Vue.component('v-hour-minute', {\r\n\r\n    \/\/ \u7701\u7565    \r\n\r\n    <strong>template: `&lt;span&gt;<\/strong>\r\n<strong>            &lt;select v-model=\"hours\"&gt;<\/strong><strong>&lt;\/select&gt;<\/strong>\r\n<strong>            &lt;span&gt;\uff1a&lt;\/span&gt;<\/strong>\r\n<strong>            &lt;select v-model=\"minutes\"&gt;<\/strong><strong>&lt;\/select&gt;<\/strong>\r\n<strong>            &lt;input :name=\"name\" type=\"hidden\" v-model=\"value\"&gt;<\/strong>\r\n<strong>        &lt;\/span&gt;`,\r\n<\/strong>\r\n    <strong>data() {<\/strong>\r\n<strong>        return {<\/strong>\r\n<strong>            hours: '',<\/strong>\r\n<strong>            minutes: ''<\/strong>\r\n<strong>        };<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u30dd\u30a4\u30f3\u30c8\u306b\u306a\u308b\u306e\u304c\u3001<code>data<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u901a\u5e38\u306e<strong>Vue\u3067data\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u306f\u76f4\u63a5\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067OK\u3067\u3057\u305f\u304c\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u5834\u5408\u306f\u95a2\u6570\u3067 return \u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/p>\n<p>\uff08\u901a\u5e38\u306e\u5834\u5408\uff09<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    <strong>data: {<\/strong>\r\n<strong>        time: '22:10'<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\uff08\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u5834\u5408\uff09<\/p>\n<pre>Vue.component('v-test', {\r\n    <strong>data() {<\/strong>\r\n<strong>        return {<\/strong>\r\n<strong>            user: '\u5c71\u7530\u592a\u90ce'<\/strong>\r\n<strong>        };<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\u307e\u305f\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u3067\u308f\u3056\u308f\u3056<code>&lt;input type=\"hidden\"&gt;<\/code>\u3092\u7528\u610f\u3057\u3066\u3044\u308b\u306e\u306f\u3001Ajax\u9001\u4fe1\u3060\u3051\u3067\u306a\u304f\u901a\u5e38\u3069\u304a\u308a<code>&lt;form&gt;&lt;\/form&gt;<\/code>\u306e\u9001\u4fe1\u306b\u3082\u5bfe\u5fdc\u3055\u305b\u308b\u305f\u3081\u3067\u3059\u3002\u3064\u307e\u308a\u3001Ajax\u9001\u4fe1\u3060\u3051\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30bf\u30b0\u3082<code>name<\/code>\u30d7\u30ed\u30d1\u30c6\u30a3\u3082\u4e0d\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>&lt;input <strong>:name=\"name\"<\/strong> type=\"hidden\" v-model=\"value\"&gt;<\/pre>\n<h3>\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u9078\u629e\u80a2\u3068\u5909\u66f4\u30a4\u30d9\u30f3\u30c8\u3092\u3064\u304f\u308b<\/h3>\n<p>\u7d9a\u3044\u3066\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4e2d\u306b\u7528\u610f\u3057\u305f\uff12\u3064\u306e\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u95a2\u9023\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre>Vue.component('v-hour-minute', {\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    template: `&lt;span class=\"border p-1\"&gt;\r\n            &lt;select v-model=\"hours\"<strong> @change=\"onChange\"<\/strong>&gt;\r\n                &lt;option&gt;&lt;\/option&gt;\r\n                &lt;option <strong>v-for=\"(text,value) in options(24)\" :value=\"value\" v-text=\"text\"<\/strong>&gt;&lt;\/option&gt;\r\n            &lt;\/select&gt;\r\n            &lt;span&gt;\uff1a&lt;\/span&gt;\r\n            &lt;select v-model=\"minutes\" <strong>@change=\"onChange\"<\/strong>&gt;\r\n                &lt;option&gt;&lt;\/option&gt;\r\n                &lt;option <strong>v-for=\"(text,value) in options(60)\" :value=\"value\" v-text=\"text\"<\/strong>&gt;&lt;\/option&gt;\r\n            &lt;\/select&gt;\r\n            &lt;input :name=\"name\" type=\"hidden\" v-model=\"value\"&gt;\r\n        &lt;\/span&gt;`,\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    methods: {\r\n\r\n        \/\/ \u300c\u6642\u30fb\u5206\u300d\u304c\u5909\u66f4\u3055\u308c\u305f\u3089\u5b9f\u884c\r\n        <strong>onChange() {<\/strong>\r\n\r\n<strong>            let time = '';<\/strong>\r\n\r\n<strong>            if(this.hours &amp;&amp; this.minutes) {<\/strong>\r\n\r\n<strong>                time = this.hours.toString().padStart(2, '0') +':'+<\/strong>\r\n<strong>                    this.minutes.toString().padStart(2, '0');<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>            this.$emit('input', time);<\/strong>\r\n\r\n<strong>        },\r\n<\/strong>\r\n        \/\/ \u300c\u6642\u30fb\u5206\u300d\u306e\u9078\u629e\u80a2\r\n        <strong>options(limitValue) {<\/strong>\r\n\r\n<strong>            let options = {};<\/strong>\r\n\r\n<strong>            for(let i = 0 ; i &lt; limitValue ; i++) {<\/strong>\r\n\r\n<strong>                options[i] = i.toString().padStart(2, '0');<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>            return options;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u307e\u305a\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u9078\u629e\u80a2\u3092\u4f5c\u308b<code>options()<\/code>\u3067\u3059\u304c\u3001\u30dd\u30a4\u30f3\u30c8\u306f<code>padStart()<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u4f8b\u3048\u3070<code>1<\/code>\u3092<code>01<\/code>\u3068\u3044\u3046\u3088\u3046\u306b\u6841\u6570\u3092\u5f37\u5236\u7684\u306b\u306b\u5909\u66f4\u3059\u308b\u3082\u306e\u3067\u3059\u304c\u3001\u6c17\u3092\u3064\u3051\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304c\u3001<strong>padStart()\u306f\u6587\u5b57\u5217\u306e\u307f\u3067\u4f7f\u3048\u308b<\/strong>\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u308f\u3056\u308f\u3056<code>toString()<\/code>\u3067\u6570\u5b57\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u3066\u3044\u308b\u306e\u306f\u3053\u306e\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>onChange()<\/code>\u306f\u300c\u6642\u30fb\u5206\u300d\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u308b\u30a4\u30d9\u30f3\u30c8\u7528\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u304c\u3001\u3053\u306e\u4e2d\u3067\u306f<code>hours<\/code>\u3068<code>minutes<\/code>\u4e21\u65b9\u304c\u63c3\u3063\u3066\u3044\u308b\u5834\u5408\u3060\u3051<code>xx:yy<\/code>\u3068\u3044\u3046\u5f62\u5f0f\u3067\u6642\u9593\u306e\u6587\u5b57\u5217\u3092\u3064\u304f\u3063\u3066\u3044\u307e\u3059\u3002\uff08\u3064\u307e\u308a\uff12\u3064\u306e\u5024\u304c\u63c3\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u7a7a\u767d\uff09<\/p>\n<p>\u306a\u304a\u3001Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u306f<code>value<\/code>\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u306b\u306f<code>$emit<\/code>\u3067<code>input<\/code>\u30a4\u30d9\u30f3\u30c8\u306a\u3069\u3092\u9001\u51fa\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>this.$emit('input', 'xxx'); \/\/ \u3053\u308c\u3067\u300cvalue\u300d\u304c\u300cxxx\u300d\u306b\u66f4\u65b0\u3055\u308c\u307e\u3059<\/strong><\/pre>\n<p>\u3067\u306f\u4eca\u306e\u6642\u70b9\u3067\u898b\u305f\u76ee\u304c\u3069\u306e\u3088\u3046\u306b\u306a\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4678\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_2.png\" alt=\"\" width=\"126\" height=\"406\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_2.png 126w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_2-93x300.png 93w\" sizes=\"auto, (max-width: 126px) 100vw, 126px\" \/><\/p>\n<h3>\u521d\u671f\u5024\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h3>\n<p>\u3067\u306f\u6700\u5f8c\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u521d\u671f\u5024\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;v-hour-minute <strong>value=\"23:15\"<\/strong>&gt;&lt;\/v-hour-minute&gt;<\/pre>\n<p>\u521d\u671f\u5024\u306f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u8aad\u307f\u8fbc\u307e\u308c\u305f\u6642\u70b9\u3067\u5b9f\u884c\u3055\u308c\u308b<code>mounted()<\/code>\u5185\u3067\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3044\u300c\u6642\u30fb\u5206\u300d\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre>Vue.component('v-hour-minute', {\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    methods: {\r\n\r\n        \/\/ \u7701\u7565\r\n\r\n        <strong>setTime() {<\/strong>\r\n\r\n<strong>            const matches = this.value.match(\/([0-9]{2}):([0-9]{2})\/);<\/strong>\r\n\r\n<strong>            \/\/ \u3059\u3067\u306b\u5024\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u5834\u5408<\/strong>\r\n<strong>            if(matches) {<\/strong>\r\n\r\n<strong>                this.hours = parseInt(matches[1]);<\/strong>\r\n<strong>                this.minutes = parseInt(matches[2]);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n    },\r\n    watch: {\r\n        value() {\r\n\r\n            <strong>this.setTime();<\/strong>\r\n\r\n        }\r\n    },\r\n    mounted() {\r\n\r\n        <strong>this.setTime();<\/strong>\r\n\r\n    }\r\n});<\/pre>\n<p><strong>\u3010\u8ffd\u8a18: 2019.09.30\u3011<\/strong><\/p>\n<p>\u4ee5\u524d\u306e\u307e\u307e\u3067\u306f\u3001\u52d5\u7684\u306b\u5024\u304c\u5909\u66f4\u3055\u308c\u305f\u5834\u5408\u306b\u5bfe\u5fdc\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067\u3001<code>watch()<\/code>\u3068<code>mounted()<\/code>\u4e21\u65b9\u3067\u6642\u9593\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002\uff08\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30fb\u30d5\u30a1\u30a4\u30eb\u3082\u4fee\u6b63\u6e08\u307f\u3067\u3059\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>\u3082\u3061\u308d\u3093<code>value<\/code>\u3068<code>v-model<\/code>\u306f\u9023\u52d5\u3057\u3066\u3044\u308b\u306e\u3067\u6b21\u306e\u3088\u3046\u306a\u4f7f\u3044\u65b9\u3082OK\u3067\u3059\u3002<\/p>\n<p><strong>\uff08HTML\u5074\uff09<\/strong><\/p>\n<pre>&lt;v-hour-minute <strong>v-model=\"time\"<\/strong>&gt;&lt;\/v-hour-minute&gt;<\/pre>\n<p><strong>\uff08JavaScript\u5074\uff09<\/strong><\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>time: '22:10'<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u304a\u75b2\u308c\u3055\u307e\u3067\u3057\u305f\uff01<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3059\u308b\u69d8\u5b50\u3092\u52d5\u753b\u3067\u3054\u89a7\u304f\u3060\u3055\u3044\uff01<\/p>\n<p><iframe loading=\"lazy\" title=\"\u3010Vue.js\u3011\u6642\u30fb\u5206\uff12\u3064\u304c\u9023\u643a\u3059\u308b\u6642\u9593\u5165\u529b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\" width=\"525\" height=\"394\" src=\"https:\/\/www.youtube.com\/embed\/lqki2gSG1rg?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>\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\uff01<\/p>\n<h1>\u3061\u306a\u307f\u306b\uff1aAMPM\u3082\u3064\u3051\u308b\u5834\u5408<\/h1>\n<p>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u3001\u300c\u6642\u30fb\u5206\u300d\u3060\u3051\u3067\u306a\u304f\u5348\u524d\u5348\u5f8c\u3092\u8868\u3059\u300cAMPM\u300d\u3082\u9078\u629e\u3067\u304d\u308b\u30b3\u30fc\u30c9\u3082\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u57fa\u672c\u7684\u306b\u306f\u3053\u308c\u307e\u3067\u306e\u5185\u5bb9\u3068\u540c\u3058\u306a\u306e\u3067\u8aac\u660e\u306f\u7701\u7565\u3057\u307e\u3059\u304c\u3001\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u4ee5\u4e0b\u306e\u300c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u300d\u304b\u3089\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n<p>\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4684\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/09\/vue_time_component_3.png\" alt=\"\" width=\"171\" height=\"43\" \/><\/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\uff08<code>CDN<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u5c55\u958b\u3057\u305f\u3089\u3059\u3050\u5b9f\u884c\u3067\u304d\u307e\u3059\uff09<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=4696&amp;tmstv=1777537969\" rel=\"nofollow\" id=\"download-link-4696\" data-redirect=\"false\" >\n\t\u6642\u9593\u5165\u529bVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/a>\n\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306f\u300c\u6642\u30fb\u5206\u300d\u304c\u9023\u643a\u3059\u308b\u6642\u9593\u306e\u5165\u529b\u30dc\u30c3\u30af\u30b9\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u306f\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306a\u306e\u3067\u3001\u6700\u77ed\uff12\u30af\u30ea\u30c3\u30af\u3060\u3051\u3067\u5165\u529b\u304c\u3067\u304d\u3001\u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\u304c\u5411\u4e0a\u3059\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u4eca\u56de\u306f\u4f5c\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c<code>step<\/code>\u3068\u3044\u3046\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u3064\u304f\u3063\u3066\u300c\u5206\u300d\u30925\u5206\u3054\u3068\u308415\u5206\u3054\u3068\u306b\u3059\u308b\u3068\u3088\u308a\u5165\u529b\u304c\u697d\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u8a66\u3057\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-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u308c\u306f\u4eca\u306b\u59cb\u307e\u3063\u305f\u308f\u3051\u3058\u3083\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3084\u306f\u308a\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u306b\u643a\u308f\u308b\u4eba\u9593\u3068\u3057\u3066\u3044\u3064\u3082\u5fc3\u639b\u3051\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002 \u305d\u308c\u304c\u3001 \u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\uff08\u4f7f\u3044\u3084\u3059 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4675\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Vue\u306a\u3089\u7c21\u5358\uff01\u6642\u30fb\u5206\u304c\u9023\u643a\u3059\u308b\u6642\u9593\u5165\u529b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08DL\u53ef\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4691,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[178],"class_list":["post-4675","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vue-js","tag-178"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4675","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=4675"}],"version-history":[{"count":13,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4675\/revisions"}],"predecessor-version":[{"id":4694,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4675\/revisions\/4694"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4691"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}