text: (function(t){function e(e){for(var a,r,i=e[0],c=e[1],u=e[2],l=0,p=[];l<i.length;l++)r=i[l],Object.prototype.hasOwnProperty.call(s,r)&&s[r]&&p.push(s[r][0]),s[r]=0;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(t[a]=c[a]);m&&m(e);while(p.length)p.shift()();return o.push.apply(o,u||[]),n()}function n(){for(var t,e=0;e<o.length;e++){for(var n=o[e],a=!0,i=1;i<n.length;i++){var c=n[i];0!==s[c]&&(a=!1)}a&&(o.splice(e--,1),t=r(r.s=n[0]))}return t}var a={},s={app:0},o=[];function r(e){if(a[e])return a[e].exports;var n=a[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=a,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/";var i=window["webpackJsonp"]=window["webpackJsonp"]||[],c=i.push.bind(i);i.push=e,i=i.slice();for(var u=0;u<i.length;u++)e(i[u]);var m=c;o.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"17be":function(t,e,n){"use strict";n("84f7")},"56d7":function(t,e,n){"use strict";n.r(e);n("e260"),n("e6cf"),n("cca6"),n("a79d");var a=n("2b0e"),s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("vue-curd-component")},o=[],r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("p"),n("div",{staticClass:"fixed-bottom bg-dark text-white",style:{opacity:.75}},[n("span",{domProps:{innerHTML:t._s(t.space)}}),n("span",[t._v(t._s(t.status))])]),n("h3",[t._v("投稿")]),n("p"),n("form",{on:{submit:function(e){return e.preventDefault(),t.handleInsert(e)}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.name,expression:"name"}],staticClass:"form-control",attrs:{type:"text",placeholder:"名前"},domProps:{value:t.name},on:{input:function(e){e.target.composing||(t.name=e.target.value)}}}),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.comment,expression:"comment"}],staticClass:"form-control",attrs:{rows:"5",placeholder:"コメントを入力します。"},domProps:{value:t.comment},on:{input:function(e){e.target.composing||(t.comment=e.target.value)}}}),t._v(" "),n("input",{staticClass:"btn btn-primary",attrs:{type:"submit",value:"登録"}})]),n("p"),n("h3",[t._v("一覧")]),n("p"),n("div",{staticClass:"card-columns"},t._l(t.items,(function(e,a){return n("div",{key:e.id},[t.mode[a]?[n("div",{staticClass:"card"},[n("form",{on:{submit:function(n){return n.preventDefault(),t.handleUpdate(a,e.id,n)}}},[n("div",{staticClass:"card-header"},[n("input",{staticClass:"form-control",attrs:{type:"text",name:"txt_name"},domProps:{value:e.name}})]),n("div",{staticClass:"card-body"},[n("textarea",{staticClass:"form-control",attrs:{name:"txt_comment",rows:"5"},domProps:{value:e.comment}})]),n("div",{style:{textAlign:"right"}},[n("input",{staticClass:"btn btn-secondary",attrs:{type:"submit",value:"キャンセル"},on:{click:function(e){return e.preventDefault(),t.$root.$set(t.mode,a,!t.mode[a])}}}),n("span",{domProps:{innerHTML:t._s(t.space)}}),n("input",{staticClass:"btn btn-primary",attrs:{type:"submit",value:"更新"}}),n("span",{domProps:{innerHTML:t._s(t.space)}})]),n("p")])])]:[n("div",{staticClass:"card"},[n("div",{staticClass:"card-header"},[t._v(" "+t._s(e.name)+" "),n("br"),t._v(t._s(t.formatConversion(e.updated_at))+" ")]),n("div",{staticClass:"card-body"},[t._v(" "+t._s(e.comment)+" "),n("br"),n("br"),n("form",[n("div",{style:{textAlign:"right"}},[n("input",{staticClass:"btn btn-primary",attrs:{type:"submit",value:"編集"},on:{click:function(e){return e.preventDefault(),t.$root.$set(t.mode,a,!t.mode[a])}}}),n("span",{domProps:{innerHTML:t._s(t.space)}}),n("input",{staticClass:"btn btn-danger",attrs:{type:"submit",value:"削除"},on:{click:function(n){return n.preventDefault(),t.handleDelete(a,e.id,n)}}}),n("span",{domProps:{innerHTML:t._s(t.space)}})])])])])]],2)})),0)])},i=[],c=(n("cb29"),n("fb6a"),n("a434"),n("b0c0"),n("53ca")),u=n("b166"),m=n("b805"),l=n.n(m),p=(n("8512"),n("bc3a")),d=n.n(p),f={data:function(){return{items:[],mode:[],name:"",comment:"",status:"ここに「Ajax」に関するメッセージが表示されます。",space:"&nbsp;&nbsp;"}},mounted:function(){var t=this;d.a.get("http://localhost:8765/api.json").then((function(e){200==e.status?(t.items=e.data,t.mode=Array(e.data.length).fill(!1)):t.status="初期情報が読み込めませんでした。"})).catch((function(e){t.status=e.message}))},methods:{run_ajax:function(t,e,n){var a=this;d()({method:t,baseURL:e,data:n,headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")}}).then((function(t){a.status="サーバーからのメッセージ("+a.formatConversion(new Date)+") ："+t.data.msg,t.data.id&&("error"==t.data.id||(a.items.unshift({id:t.data.id,name:t.data.name,comment:t.data.comment,updated_at:t.data.updated_at}),a.mode.unshift(!1)))})).catch((function(t){a.status=t.message}))},formatConversion:function(t){if("object"!==Object(c["a"])(t)&&-1===t.indexOf("T")){var e=t.slice(0,10),n="T",a=t.slice(11),s=".000Z";t=e+n+a+s}return Object(u["a"])(new Date(Date.parse(t)),"yyyy年MM月dd日(iiiii) HH:mm:ss",{locale:l.a})},handleInsert:function(t){this.name&&this.comment&&(this.run_ajax("POST","http://localhost:8765/api.json",{name:this.name,comment:this.comment}),this.name="",this.comment="")},handleUpdate:function(t,e,n){var a=new FormData(n.target),s=a.get("txt_name"),o=a.get("txt_comment");s&&o&&(this.items[t].name!=s||this.items[t].comment!=o)&&(this.$root.$set(this.items[t],"name",s),this.$root.$set(this.items[t],"comment",o),this.$root.$set(this.items[t],"updated_at",new Date),this.run_ajax("PUT","http://localhost:8765/api.json?id="+e,{name:s,comment:o})),this.$root.$set(this.mode,t,!this.mode[t])},handleDelete:function(t,e,n){this.items.splice(t,1),this.mode.splice(t,1),this.run_ajax("DELETE","http://localhost:8765/api.json?id="+e,{})}},computed:{}},h=f,v=(n("17be"),n("2877")),b=Object(v["a"])(h,r,i,!1,null,"63ee36c1",null),y=b.exports,_={name:"App",components:{VueCurdComponent:y}},g=_,x=Object(v["a"])(g,s,o,!1,null,null,null),j=x.exports;a["a"].config.productionTip=!1,new a["a"]({render:function(t){return t(j)}}).$mount("#app")},"84f7":function(t,e,n){}});
  