{"id":469,"date":"2018-04-19T18:09:09","date_gmt":"2018-04-19T09:09:09","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=469"},"modified":"2018-04-19T18:09:09","modified_gmt":"2018-04-19T09:09:09","slug":"%e3%81%9f%e3%81%a3%e3%81%9f%ef%bc%95%e7%a7%92%ef%bc%81vue%e3%81%ae%e3%83%81%e3%82%a7%e3%83%83%e3%82%af%e3%83%9c%e3%83%83%e3%82%af%e3%82%b9%e3%81%abvalue%e3%82%92%e8%a8%ad%e5%ae%9a%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=469","title":{"rendered":"\u305f\u3063\u305f\uff15\u79d2\uff01Vue\u306e\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306bvalue\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u73fe\u5728\u3001Vue\u3092\u30e1\u30a4\u30f3\u306eJS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u5909\u3048\u3066\u304b\u3089\uff11\u5e74\u4ee5\u4e0a\u304c\u7d4c\u3061\u307e\u3057\u305f\u3051\u3069\u3001\u3053\u308c\u307e\u3067\u307b\u307c\u4e0d\u4fbf\u306a\u72b6\u6cc1\u3082\u767a\u751f\u305b\u305a\u3001\u3044\u3064\u3082\u958b\u767a\u306e\u52b9\u7387\u5316\u306b\u8ca2\u732e\u3057\u3066\u3082\u3089\u3063\u3066\u307e\u3059\u3002<\/p>\n<p>\u3055\u3059\u304c\u306b\u4fdd\u5b88\u304c\u96e3\u3057\u304f\u306a\u308a\u3059\u304e\u3066\u3057\u307e\u3046\u306e\u3067SPA\u5316\u306f\u8003\u3048\u3066\u306a\u3044\u3093\u3067\u3059\u3051\u3069\u3001Vue\u306e\u304a\u304b\u3052\u3067\u30ed\u30b8\u30c3\u30af\u3092\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u306b\u79fb\u52d5\u3055\u305b\u308b\u3053\u3068\u3082\u591a\u304f\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306fVue\u306e\u8a71\u984c\u306a\u3093\u3067\u3059\u3051\u3069\u3001\u72b6\u6cc1\u3068\u3057\u3066\u306f\u300cVue\u3068Ajax\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u9001\u4fe1\u3059\u308b\u300d\u3068\u3044\u3046\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u5834\u5408\u306b\u3001\u5c11\u3057\u3068\u307e\u3069\u3063\u305f\u90e8\u5206\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u305d\u308c\u3092\u307e\u3068\u3081\u3066\u304a\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h1>\u4f55\u304c\u554f\u984c\u306a\u306e\u304b<\/h1>\n<p>\u3069\u3093\u306a\u3053\u3068\u304b\u3068\u3044\u3046\u3068\u3001\u305a\u3070\u308a<\/p>\n<p><strong style=\"font-size: 35px;\">Vue\u3067\u300cv-model\u300d\u3092\u8a2d\u5b9a\u3057\u305f\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306e\u5024\u304c\u8a2d\u5b9a\u3067\u304d\u306a\u3044<\/strong><\/p>\n<p>\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001Vue\u3067\u57fa\u672c\u7684\u306a\u30c6\u30ad\u30b9\u30c8\u5165\u529b\u3092\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\uff08HTML\uff09<\/p>\n<pre><strong>&lt;input type=\"text\" v-model=\"value\"&gt;<\/strong><\/pre>\n<p>\uff08JS\uff09<\/p>\n<pre><strong>new Vue({<\/strong>\r\n<strong>    el: '#app',<\/strong>\r\n<strong>    data: {<\/strong>\r\n<strong>        value: 'xxx'<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>});<\/strong><\/pre>\n<p>\u3067\u3001\u3053\u306e\u6d41\u308c\u3067\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3082\u540c\u3058\u304f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\uff08HTML\uff09<\/p>\n<pre>&lt;input type=\"<strong>checkbox<\/strong>\" v-model=\"value\"&gt;<\/pre>\n<p>\uff08JS\uff09<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        value: false\r\n    }\r\n});<\/pre>\n<p>\u3082\u3061\u308d\u3093\u3001\u3053\u308c\u3067\u554f\u984c\u306a\u304f\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u304c\u30c1\u30a7\u30c3\u30af\u3055\u308c\u3066\u308b\u304b\u3069\u3046\u304b\u306b\u3088\u3063\u3066\u3001\u300ctrue\u300d\u3068\u300cfalse\u300d\u304c\u5207\u308a\u66ff\u308f\u3063\u3066\u304f\u308c\u307e\u3059\u3002\u3055\u3059\u304cVue\u3002\u3068\u3066\u3082\u30b7\u30f3\u30d7\u30eb\u306b\u3053\u308c\u3060\u3051\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u3053\u308c\u3060\u3068\u3061\u3087\u3063\u3068\u554f\u984c\u3068\u3044\u3046\u304b\u3001\u6c17\u306b\u306a\u308b\u3053\u3068\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u305d\u308c\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u3053\u306e\u307e\u307e\u3060\u3068\u3001Ajax\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9001\u4fe1\u3057\u305f\u5834\u5408\u3001true\uff0ffalse\u304c\u30c6\u30ad\u30b9\u30c8\u3068\u3057\u3066\u9001\u4fe1\u3055\u308c\u3066\u3057\u307e\u3046<\/strong><\/p>\n<p>\u306e\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u53d7\u4fe1\u5074\u306ePHP\u3067\u306f\u3001<\/p>\n<pre><strong>if($_POST['value'] == 'true') {<\/strong>\r\n\r\n    \/\/ \u4f55\u304b\r\n\r\n<strong>}<\/strong><\/pre>\n<p>\u3068\u3044\u3046\u3088\u3046\u306b\u3001\u300ctrue\uff0ffalse\u300d\u3092\u30c6\u30ad\u30b9\u30c8\u5316\u3057\u305f\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u3093\u30fc\u3001\u5225\u306b\u3053\u308c\u3067\u3044\u3044\u3063\u3061\u3083\u3044\u3044\u3093\u3067\u3059\u3051\u3069\u3001\u30d1\u30c3\u3068\u898b\u3059\u308b\u3068\u300c\u3046\u308f\u3001\u9593\u9055\u3048\u3066\u3093\u3058\u3083\u3093\u30fb\u30fb\u30fb\u300d\u3068\u601d\u3063\u3061\u3083\u3046\u306e\u3067\u3001\u4eca\u5f8c\u30b3\u30fc\u30c9\u3092\u6539\u5584\u3059\u308b\u3068\u304d\u306b<strong>\u4f55\u3082\u8003\u3048\u305a\u306btrue\u90e8\u5206\u3092\u53d6\u308a\u9664\u3044\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u304c\u3067\u3066\u304d\u307e\u3059\u3002<\/strong>\u3060\u304b\u3089\u3001\u3067\u304d\u308c\u3070\u300cyes\uff0fno\u300d\u3068\u304b\u306b\u5909\u66f4\u3057\u305f\u3044\u308f\u3051\u3067\u3059\u306d\u3002<br \/>\n\u306a\u306b\u3088\u308a\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u3068\u3057\u3066\u4f55\u304b\u5c45\u5fc3\u5730\u304c\u60aa\u3044\u3067\u3059\u3057\uff08\u7b11\uff09<\/p>\n<p>\u203b\u3061\u306a\u307f\u306b\u901a\u5e38\u306eHTML\u30d5\u30a9\u30fc\u30e0\u3060\u3068\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306f\u30c1\u30a7\u30c3\u30af\u304c\u5165\u3063\u3066\u3044\u306a\u3044\u3068\u3001\u30c7\u30fc\u30bf\u9001\u4fe1\u3059\u3089\u3055\u308c\u306a\u3044\u3002\u3067\u3082\u3001Vue\u306e\u5834\u5408\u306ftrue\uff0ffalse\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u307e\u3059<\/p>\n<h1>\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306b\u5024\u3092\u8a2d\u5b9a\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001Vue\u3067\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306b\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u5834\u5408\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u306e\u304b\u3002<br \/>\n\u307e\u305a\u6700\u521d\u306b\u601d\u3044\u3064\u3044\u305f\u306e\u304c\u3001data\u306b\u300cyes\u300d\u3092\u767b\u9332\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>\u4e88\u60f3\u3068\u3057\u3066\u306f\u3001\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306e\u5207\u308a\u66ff\u3048\u3068\u540c\u6642\u306b\u300cyes\u300d\u3068\u7a7a\u767d\u304c\u5207\u308a\u66ff\u308f\u308b\u306e\u304b\u306a\uff1f\u3068\u601d\u3063\u305f\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\uff08HTML\uff09<\/p>\n<pre><strong>&lt;input type=\"checkbox\" v-model=\"value\"&gt;<\/strong><\/pre>\n<p>\uff08JS\uff09<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        value: <strong>'yes' \/\/ \u3053\u306e\u30b3\u30fc\u30c9\u306f\u3046\u307e\u304f\u3044\u304d\u307e\u305b\u3093<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3067\u3082\u3001\u3053\u306e\u30b3\u30fc\u30c9\u306f\u3046\u307e\u304f\u3044\u304d\u307e\u305b\u3093\u3002<br \/>\n\u6700\u521d\u3053\u305d\u300cyes\u300d\u306e\u5024\u306b\u306a\u308a\u307e\u3059\u3051\u3069\u3001<strong>\u4e00\u56de\u3067\u3082\u30c1\u30a7\u30c3\u30af\u3055\u308c\u308b\u3068\u5143\u306e\u300ctrue\/false\u300d\u306b\u3082\u3069\u3063\u3066\u3057\u307e\u3046<\/strong>\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u3046\u30fc\u3093\u3001\u3069\u3046\u3057\u305f\u3082\u306e\u304b\u3068\u3001Vue\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8aad\u3093\u3067\u3044\u308b\u3068<a href=\"https:\/\/jp.vuejs.org\/v2\/guide\/forms.html#\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9-1\" target=\"_blank\" rel=\"noopener\">\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306e\u9805\u76ee<\/a>\u306b\u3053\u3093\u306a\u3082\u306e\u3092\u767a\u898b\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre>&lt;input\r\n    type=\"checkbox\"\r\n    v-model=\"toggle\"\r\n    <strong>true-value=\"yes\"<\/strong>\r\n    <strong>false-value=\"no\"<\/strong>\r\n&gt;<\/pre>\n<p>\u3093\uff1f\uff1f<\/p>\n<ul>\n<li><strong>true-value<\/strong><\/li>\n<li><strong>false-value<\/strong><\/li>\n<\/ul>\n<p>\u304a\u304a\u3063\u3001\u305d\u3093\u306a\u4fbf\u5229\u306a\u66f8\u304d\u65b9\u304c\u3042\u3063\u305f\u306e\u304b\uff01<br \/>\n\u3064\u307e\u308a\u3001\u3055\u3063\u304d\u306e\u4f8b\u3067\u8a00\u3046\u3068<\/p>\n<p>\uff08HTML\uff09<\/p>\n<pre>&lt;input type=\"checkbox\" <strong>true-value=\"yes\" false-value=\"no\"<\/strong> v-model=\"value\"&gt;<\/pre>\n<p>\uff08JS\uff09<\/p>\n<pre>new Vue({\r\n    el: '#app',\r\n    data: {\r\n        <strong>value: 'yes'<\/strong>\r\n    }\r\n});<\/pre>\n<p>\u3068\u3059\u308c\u3070\u3001\u300cvalue\u300d\u306e\u4e2d\u8eab\u306f\u300cyes\/no\u300d\u3067\u56fa\u5b9a\u3055\u308c\u308b\u306e\u3067\u3001PHP\u3067\u3082<\/p>\n<pre>if($_POST['value'] == <strong>'yes'<\/strong>) {\r\n\r\n    \/\/ \u4f55\u304b\r\n\r\n}<\/pre>\n<p>\u3067\u30c1\u30a7\u30c3\u30af\u306e\u6709\u7121\u3067\u5206\u5c90\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u306d\u3002<br \/>\n\u3084\u3063\u3071\u308aVue\u306f\u4f7f\u3044\u3084\u3059\u3044\u3067\u3059\u266a<\/p>\n<p>\u203b\u6ce8\u610f\u3059\u3079\u304d\u70b9\u3068\u3057\u3066\u306f\u3001\u3082\u3057Ajax\u3058\u3083\u306a\u304fHTML\u306e\u30d5\u30a9\u30fc\u30e0\u3067\u30c7\u30fc\u30bf\u9001\u4fe1\u3059\u308b\u3068\u304d\u306f\u300cyes\/no\u300d\u306f\u95a2\u4fc2\u306a\u304f\u3001\u901a\u5e38\u306e\u300c\u30c7\u30fc\u30bf\u306e\u6709\u7121\u300d\u3067\u30c1\u30a7\u30c3\u30af\u3092\u5224\u5225\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h1>\u3061\u306a\u307f\u306b<\/h1>\n<p>Laravel\u306b\u300c<strong>accepted<\/strong>\u300d\u3068\u3044\u3046\u3001\u300c\u5229\u7528\u898f\u7d04\u306b\u540c\u610f\u3059\u308b\u300d\u30c1\u30a7\u30c3\u30af\u30dc\u30b9\u306b\u4f7f\u308f\u308c\u308b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30fb\u30eb\u30fc\u30eb\u304c\u3042\u308b\u3093\u3067\u3059\u3051\u3069\u3001\u3053\u308c\u306f\u8a72\u5f53\u30c7\u30fc\u30bf\u304c<\/p>\n<ul>\n<li><strong><em>yes<\/em><\/strong><\/li>\n<li><strong><em>on<\/em><\/strong><\/li>\n<li><strong><em>1<\/em><\/strong><\/li>\n<li><strong><em>true<\/em><\/strong><\/li>\n<\/ul>\n<p>\u306e\u3069\u308c\u304b\u3060\u3068OK\u306b\u306a\u308b\u3093\u3067\u3001\u4eca\u56de\u306e\u3088\u3046\u306b\u300cyes\uff0fno\u300d\u306e\u5024\u3067\u554f\u984c\u306a\u304f\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\nLaravel\u3082\u3055\u3059\u304c\u3067\u3059\u306d\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306fVue\u306e\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3068v-model\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u304a\u5f79\u306b\u7acb\u3066\u305f\u3089\u5149\u6804\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-428 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/30.png\" alt=\"\" width=\"205\" height=\"350\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/30.png 205w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/30-176x300.png 176w\" sizes=\"auto, (max-width: 205px) 100vw, 205px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73fe\u5728\u3001Vue\u3092\u30e1\u30a4\u30f3\u306eJS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u5909\u3048\u3066\u304b\u3089\uff11\u5e74\u4ee5\u4e0a\u304c\u7d4c\u3061\u307e\u3057\u305f\u3051\u3069\u3001\u3053\u308c\u307e\u3067\u307b\u307c\u4e0d\u4fbf\u306a\u72b6\u6cc1\u3082\u767a\u751f\u305b\u305a\u3001\u3044\u3064\u3082\u958b\u767a\u306e\u52b9\u7387\u5316\u306b\u8ca2\u732e\u3057\u3066\u3082\u3089\u3063\u3066\u307e\u3059\u3002 \u3055\u3059 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=469\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u305f\u3063\u305f\uff15\u79d2\uff01Vue\u306e\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306bvalue\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":471,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,12],"tags":[35],"class_list":["post-469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-vue-js","tag-ajax"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/469","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=469"}],"version-history":[{"count":1,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/469\/revisions"}],"predecessor-version":[{"id":470,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/469\/revisions\/470"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/471"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}