{"id":1834,"date":"2018-06-08T21:02:32","date_gmt":"2018-06-08T12:02:32","guid":{"rendered":"https:\/\/lovelinux.mydns.jp\/?p=1834"},"modified":"2018-06-08T21:25:36","modified_gmt":"2018-06-08T12:25:36","slug":"vue-js%e3%81%a8vuex%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%80%81%e3%82%ab%e3%82%a6%e3%83%b3%e3%82%bf%e3%83%bc%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86","status":"publish","type":"post","link":"https:\/\/lovelinux.mydns.jp\/?p=1834","title":{"rendered":"Vue.js\u3068Vuex\u3092\u4f7f\u3063\u3066\u3001\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u3066\u307f\u3088\u3046\u3002"},"content":{"rendered":"<p>Vue.js\u59cb\u3081\u307e\u3057\u305f\u3002\u3055\u3063\u3071\u308a\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3088\u3046\u3084\u304f\u300c\u3044\u308d\u306f\u300d\u306f<br \/>\n\u63b4\u3081\u3066\u304d\u305f\u306e\u3067\u3001vuex\u3092\u4f7f\u3063\u3066\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\nstore\u3092module\u3067\u5206\u5272\u3057\u3066\u3001\u4e2d\u898f\u6a21\u304f\u3089\u3044\u306e\u30a2\u30d7\u30ea\u306a\u3089\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u306a\u611f\u3058\u306b\u4ed5\u4e0a\u3052\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3068\u306b\u304b\u304f Vuex\u304c\u3084\u3084\u3053\u3057\u3044\u3068\u3044\u3046\u304b\u3001\u3069\u3046\u3044\u3046\u69cb\u9020\u3067\u3001\u3069\u3046\u5229\u7528\u3059\u308b\u306e\u304b\u304c\u96e3\u3057\u3044\u3002<br \/>\n\u3053\u308c\u306b\u6163\u308c\u308b\u306e\u304c\u4e00\u756a\u306e\u30ad\u30e2\u3067\u3059\u3002<\/p>\n<h3>\u51fa\u6765\u4e0a\u304c\u308a\u306e\u30a4\u30e1\u30fc\u30b8<\/h3>\n<p>\u30e1\u30c1\u30e3\u30e1\u30c1\u30e3\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u304c\u3001\u3053\u3093\u306a\u611f\u3058\u3002<br \/>\n\uff0b\uff0b\uff0b\u3092\u30af\u30ea\u30c3\u30af\u3067\u3001\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3001\u30fc\u30fc\u30fc\u3067\u30c7\u30af\u30ea\u30e1\u30f3\u30c8\u3002<br \/>\n\u73fe\u5728\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u304c\u300c\uff15\u300d<\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-08-at-18.44.59.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-08-at-18.44.59.png\" alt=\"Screen Shot 2018-06-08 at 18.44.59\" width=\"395\" height=\"462\" class=\"alignnone size-full wp-image-1835\" \/><\/a><\/p>\n<h3>Vue.js\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>[bash]<br \/>\n$ npm install -g vue-cli<\/p>\n<p>[\/bash]<\/p>\n<p>sudo \u3092\u3064\u3051\u305f\u65b9\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210<\/h3>\n<p>[bash]<br \/>\n$ cd ~\/Document<br \/>\n$ vue init webpack vue1st<br \/>\n[\/bash]<\/p>\n<p>\u8cea\u554f\u5f62\u5f0f\u3067 \u3053\u308c\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u304b\uff1f\u306a\u3069\u805e\u304b\u308c\u308b\u306e\u3067<br \/>\neslint\u3092\u9664\u3044\u3066\u306f\u3001\u3059\u3079\u3066 Enter\u30ad\u30fc\u9023\u6253\u3067OK\u3060\u3068\u601d\u3046\u3002<br \/>\neslint\u5165\u308c\u308b\u3068\u3001\u69cb\u6587\u30c1\u30a7\u30c3\u30af\u304c\u3084\u305f\u3089\u3046\u308b\u3055\u304f\u306a\u308b\u306e\u3067\u3001\u3053\u308c\u306f\u300cn\u300d\u3067\u5916\u3059\u306e\u304c\u30aa\u30b9\u30b9\u30e1\u3002<\/p>\n<h3>Vuex\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>[bash]<br \/>\n$ cd vue1st<br \/>\n$ npm install &#8211;Save vuex<br \/>\n[\/bash]<\/p>\n<h3>Store\u306e\u4f5c\u6210\u3068 main.js\u3078\u306e\u767b\u9332<\/h3>\n<p>[bash]<br \/>\n$ mkdir src\/store<br \/>\n$ nano src\/store\/index.js<\/p>\n<p>[\/bash]<\/p>\n<p>\u6700\u521d\u306f\u8a33\u304c\u308f\u304b\u3089\u3093\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u8efd\u304f\u8aac\u660e\u3002<br \/>\nVuex\u306f Vue.js\u3067\u4f5c\u308bSPA\uff08\u30b7\u30f3\u30b0\u30eb\u30da\u30fc\u30b8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff09\u306e<br \/>\n\u5168\u30b9\u30c6\u30fc\u30c8\u3092\u4e00\u62ec\u3057\u3066store\u3068\u3057\u3066\u3001\u7ba1\u7406\u3057\u307e\u3059\u3002<br \/>\n\u307e\u305a\u3001Vue.js\u3068Vuex\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u3001\u6b21\u306b<br \/>\nVue.js\u304b\u3089Vuex\u3092\u5229\u7528\u3057\u307e\u3059\u3088\u3068\u3059\u308b\u3002<\/p>\n<p>\u3067\u3001\u30a2\u30d7\u30ea\u3067\u552f\u4e00\u306estore\u3092\u4f5c\u3063\u3066\u3001\u305d\u306estore\u3067\u5229\u7528\u3059\u308bmodules\u3092\u5ba3\u8a00\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u3053\u3053\u3067\u306f\u3000&#8217;counter&#8217;: counter \u306e\u90e8\u5206\u3067\u3059\u3002<br \/>\n\u540c\u4e00\u30d5\u30a1\u30a4\u30eb\u306b\u3057\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u898f\u6a21\u304c\u5927\u304d\u304f\u306a\u308b\u3068\u898b\u901a\u3057\u304c\u60aa\u304f\u306a\u308b\u306e\u3067\u3001<br \/>\n\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u5272\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u6700\u5f8c\u306b store\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3068\u3057\u3066export\u3002<\/p>\n<p>src\/store\/index.js<br \/>\n[bash]<br \/>\nimport Vue from &#8216;vue&#8217;<br \/>\nimport Vuex from &#8216;vuex&#8217;<\/p>\n<p>import counter from &#8216;.\/counter&#8217;<\/p>\n<p>Vue.use(Vuex)<\/p>\n<p>const store = new Vuex.Store({<br \/>\n  modules :{<br \/>\n    &#8216;counter&#8217;: counter,<br \/>\n  }<br \/>\n})<\/p>\n<p>export default store<\/p>\n<p>[\/bash]<\/p>\n<h3>main.js\u3078\u306e\u767b\u9332<\/h3>\n<p>\u300c\uff0b\u300d\u3068\u306a\u3063\u3066\u3044\u308b\u884c\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\nimport Vue from &#8216;vue&#8217;<br \/>\nimport App from &#8216;.\/App&#8217;<br \/>\nimport router from &#8216;.\/router&#8217;<br \/>\n+ import store from &#8216;.\/store&#8217;<\/p>\n<p>Vue.config.productionTip = false<\/p>\n<p>\/* eslint-disable no-new *\/<br \/>\nnew Vue({<br \/>\n  el: &#8216;#app&#8217;,<br \/>\n+  store,<br \/>\n  router,<br \/>\n  components: { App },<br \/>\n  template: &#8216;<App\/>&#8216;<br \/>\n})<\/p>\n<p>[\/bash]<\/p>\n<h3>\u30ab\u30a6\u30f3\u30bf\u30fc\u306e\u30b9\u30c8\u30a2\u3092\u4f5c\u6210<\/h3>\n<p>\u3053\u3053\u304c\u591a\u5206\u4e00\u756a\u96e3\u3057\u3044\u3002<\/p>\n<p>\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u306e\u8981\u4ef6\u306f\u3001<br \/>\n\uff11.\u73fe\u5728\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u5024\u3092\u53d6\u5f97\u3067\u304d\u308b<br \/>\n\uff12.\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3067\u304d\u308b<br \/>\n\uff13.\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\u30c7\u30af\u30ea\u30e1\u30f3\u30c8\u3067\u304d\u308b<\/p>\n<p>\u30b9\u30c8\u30a2\u306b\u4fdd\u6301\u3059\u308b\u3079\u304d\u5024\u306f\u3001<br \/>\n\u30ab\u30a6\u30f3\u30bf\u30fc\u5024\uff11\u3064\u306e\u307f\u3002<\/p>\n<p>\u3053\u306e\u6761\u4ef6\u304c\u63c3\u3063\u305f\u3068\u3053\u308d\u3067\u3001<br \/>\nsrc\/store\/mutation-type.js\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>mutation\u3068\u306f\u5909\u5316\u3059\u308b\u3068\u3044\u3046\u610f\u5473\u3002<br \/>\n\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u3067\u3001Vuex\u3067\u3044\u3046\u3068\u3001<br \/>\n\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\u5897\u6e1b\u3055\u305b\u308b\u3053\u3068\u304c mutation<br \/>\n\u3053\u308c\u3092\u5b9a\u6570\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u5909\u5316\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u73fe\u5728\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206\u3082<br \/>\n\u5b9a\u6570\u5b9a\u7fa9\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u3087\u3046\u3002\uff08\u53b3\u5bc6\u306b\u306fmutation\u3067\u306f\u306a\u3044\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u5206\u304b\u308c\u308b\u3068\u3084\u3084\u3053\u3057\u3044\u306e\u3067<br \/>\n\u307e\u3068\u3081\u307e\u3059\u3002\uff09<\/p>\n<p>src\/store\/mutation-type.js<\/p>\n<p>[bash]<br \/>\nexport const INCREMENT_COUNTER = &#8216;INCREMENT_COUNTER&#8217;<br \/>\nexport const DECREMENT_COUNTER = &#8216;DECREMENT_COUNTER&#8217;<br \/>\nexport const GET_COUNTER = &#8216;GET_COUNTER&#8217;<br \/>\n[\/bash]<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u5b9a\u6570\u3092\u4f7f\u3063\u3066\u3001\u30ab\u30a6\u30f3\u30bf\u30fc\u306eStore\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u3053\u308c\u304c\u975e\u5e38\u306b\u6163\u308c\u308b\u307e\u3067\u96e3\u3057\u3044\u3002\u3002\u3002<\/p>\n<p>\u6700\u521d\u306econst\u5ba3\u8a00\u3068\u3001namespaced\u306f\u304a\u6c7a\u307e\u308a\u306a\u306e\u3067\u3001\u3053\u3093\u306a\u611f\u3058\u306a\u3093\u3060\u306a\u3068\u899a\u3048\u308b\u3002<\/p>\n<p>\u6b21\u306estate\/actions\/mutations\/getters<\/p>\n<p>\u3053\u3053\u304c\u96e3\u3057\u3044\uff01\uff01<\/p>\n<p>\u305d\u306e\u4e2d\u3067\u3082state\u306f\u30b7\u30f3\u30d7\u30eb\u3002<br \/>\n\u3053\u306e\u30b9\u30c8\u30a2\u3067\u4fdd\u6301\u3057\u305f\u3044\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u5834\u6240\u3002\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u306a\u306e\u3067<br \/>\n\u4fdd\u6301\u3059\u308b\u306e\u306f\u30ab\u30a6\u30f3\u30bf\u30fc\u306e\u5024\u4e00\u500b\u3002\u305d\u308c\u3092\u5b9a\u7fa9\u3057\u3066\u3001\u521d\u671f\u5024\u3092\u30bb\u30c3\u30c8\u3057\u307e\u3059\u3002<\/p>\n<p>actions\u306f \u3053\u308c\u304b\u3089state\u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u3093\u3060\u3051\u3069\u3001\u305d\u306e\u524d\u51e6\u7406\u3092\u3059\u308b\u5834\u6240\u3001\u3050\u3089\u3044\u306b\u6349\u3048\u3066\u304a\u304f\u3068\u826f\u3044\u3002<br \/>\n\u57fa\u672c\u3001\u753b\u9762\u4e0a\u304b\u3089\u306e\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u3068\u7d50\u3073\u3064\u304f\u5834\u6240\u3060\u3068\u8003\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3067\u3001action\u3067\u4f55\u3089\u304b\u306e\u524d\u51e6\u7406\u3092\u3057\u3066\u3001mutation\u3092\u30b3\u30df\u30c3\u30c8\u3057\u307e\u3059\u3002<br \/>\nmutation\u3067\u5b9f\u969b\u306e\u30b9\u30c8\u30a2\u306e\u5024\u3092\u66f8\u304d\u63db\u3048\u307e\u3059\u3002mutation\u3092\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u3001\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u306a\u3069\u3082<br \/>\n\u30bb\u30c3\u30c8\u3057\u3066\u3084\u308a\u307e\u3059\u3002\uff08\u4eca\u56de\u306e\u5834\u5408\u3001\u30ab\u30a6\u30f3\u30bf\u30fc\u306a\u306e\u3067\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u306f\u306a\u3044\uff09<\/p>\n<p>\u3042\u3001\u3067\u3001\u5909\u306a\u66f8\u304d\u65b9\u306a\u306e\u304c\u3001actions\u306e\u95a2\u6570\u5ba3\u8a00\u3002<br \/>\n\u5b9a\u6570\u3092[\u5b9a\u6570]\u3000\u3068\u3057\u3066\u3084\u308b\u3068\u95a2\u6570\u540d\u3068\u3057\u3066\u5229\u7528\u3067\u304d\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u5229\u7528\u3057\u3066\u307e\u3059\u3002<br \/>\n\u52a0\u3048\u3066\u52a0\u3048\u3066\u3001Vue\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u3001\u3000mapActions\u3068\u3057\u3066\u3001\u547c\u3073\u51fa\u3057\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>mutation\u306f\u7d14\u7c8b\u306b\u5f15\u6570\u306e state\u3068\u3001payload\u3092\u4f7f\u3063\u3066\u3001\u5b9f\u969b\u306estate\u3067\u4fdd\u6301\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u66f8\u304d\u63db\u3048\u308b\u51e6\u7406\u3092\u3057\u307e\u3059\u3002<br \/>\nmutation\u81ea\u4f53\u306f\u76f4\u63a5\u547c\u3073\u51fa\u3055\u308c\u308b\u3053\u3068\u306f\u306a\u304f\u3001action\u7d4c\u7531\u306a\u3069\u3067\u3001commit\u3055\u308c\u3066\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u3001getters<br \/>\n\u3053\u308c\u306f\u3001store\u306e\u5024\u3092\u8aad\u307f\u51fa\u3059\u305f\u3081\u306e\u5834\u6240\u3002<br \/>\n\u3053\u308c\u3092\u5b9a\u7fa9\u3057\u3066\u304a\u304f\u3068\u3001Vue\u30d5\u30a1\u30a4\u30eb\u304b\u3089 mapGetters\u3067<br \/>\n\u30b9\u30c8\u30a2\u60c5\u5831\u3092\u8aad\u307f\u51fa\u305b\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\nimport {INCREMENT_COUNTER, DECREMENT_COUNTER, GET_COUNTER} from &#8216;.\/mutation-type&#8217;<\/p>\n<p>const counter = {<br \/>\n  namespaced: true,<br \/>\n  state: {<br \/>\n    counter_value: 0<br \/>\n  },<br \/>\n  actions: {<br \/>\n    [INCREMENT_COUNTER] ({commit, state, rootState}) {<br \/>\n      commit(INCREMENT_COUNTER, {})<br \/>\n    },<br \/>\n    [DECREMENT_COUNTER] ({commit, state, rootState}) {<br \/>\n      commit(DECREMENT_COUNTER, {})<br \/>\n    }<br \/>\n  },<br \/>\n  mutations:{<br \/>\n    [INCREMENT_COUNTER] (state, payload) {<br \/>\n      state.counter_value += 1<br \/>\n    },<br \/>\n    [DECREMENT_COUNTER] (state, payload) {<br \/>\n      state.counter_value -= 1<br \/>\n    }<br \/>\n  },<br \/>\n  getters:{<br \/>\n    [GET_COUNTER] (state, getters, rootState) {<br \/>\n      return state.counter_value<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>export default counter<\/p>\n<p>[\/bash]<\/p>\n<h3>\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306e\u4f5c\u6210<\/h3>\n<p>\u62e1\u5f35\u5b50vue\u30d5\u30a1\u30a4\u30eb\u306f\uff13\u3064\u306e\u90e8\u5206\u3067\u69cb\u6210\u3055\u308c\u307e\u3059\u3002<br \/>\n\u30fb\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u308b html<br \/>\n\u30fb\u5b9f\u884c\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8<br \/>\n\u30fbCSS<\/p>\n<p>CSS\u306f\u666e\u901a\u306eHTML\u3068\u540c\u3058\u306a\u306e\u3067\u3001\u6700\u521d\u306e\uff12\u3064\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n<template><\/p>\n<div>\n<h3>This is Counter App<\/h3>\n<h4>{{counter}}<\/h4>\n<p>    <button @click=\"INCREMENT_COUNTER\">+++<\/button><br \/>\n    <button @click=\"DECREMENT_COUNTER\">&#8212;<\/button><\/p><\/div>\n<p><\/template><\/p>\n<p><script>\nimport { INCREMENT_COUNTER, DECREMENT_COUNTER, GET_COUNTER } from '..\/store\/mutation-type'\nimport { mapGetters, mapActions} from 'vuex'<\/p>\n<p>export default {\n  name: 'counter',\n  computed: {\n    ...mapGetters('counter', {\n      counter: GET_COUNTER\n    })\n  },\n  methods: {\n    ...mapActions('counter', [\n      INCREMENT_COUNTER,\n      DECREMENT_COUNTER\n    ])\n  }<\/p>\n<p>}\n<\/script><\/p>\n<style scoped>\n<\/style>\n<p>[\/bash]<\/p>\n<h3>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/h3>\n<p>\u4f55\u3089\u304b\u306e\u5909\u6570\u5024\u3092\u8868\u793a\u3057\u305f\u3044\u3068\u3053\u308d\u306f {{\u5909\u6570\u540d}} \u3068\uff12\u91cd\u62ec\u5f27\u3067\u304f\u304f\u3063\u3066\u3068\u3057\u307e\u3059\u3002<br \/>\n@click\u306a\u3069\u306f\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\u5834\u6240\u3067\u3001 \u4e0d\u601d\u8b70\u306a\u69cb\u6587\u306a\u306e\u3067\u3059\u304c<br \/>\n\u30c0\u30d6\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067 methods\u306e\u4e2d\u306b\u5b9a\u7fa9\u3055\u308c\u305f\u95a2\u6570\u540d\u3092\u6587\u5b57\u3068\u3057\u3066\u5b9a\u7fa9\u3057\u307e\u3059\u3002<br \/>\n\u95a2\u6570\u306b\u5f15\u6570\u304c\u3042\u308b\u5834\u5408\u3082\u3001\u5168\u90e8\u6587\u5b57\u3068\u3057\u3066\u8a18\u8ff0\u3057\u3061\u3083\u3046\u611f\u3058\u3067\u3059\u3002<br \/>\n\uff08\u3061\u3087\u3063\u3068\u5909\u308f\u3063\u3066\u307e\u3059\u306d\u30fb\u30fb\u30fb\u30fb \u500b\u4eba\u7684\u306a\u611f\u60f3\uff09<\/p>\n<p>\u3067\u3001\u307e\u3041\u5168\u3066\u3067\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30d5\u30ed\u30f3\u30c8\u3067\u8d77\u3053\u3063\u305f\u30a4\u30d9\u30f3\u30c8\u306e\u51e6\u7406\u3092<br \/>\n\u30b9\u30c8\u30a2\u306b\u5b9a\u7fa9\u3055\u308c\u305f action\u306b\u7d50\u3073\u3064\u3051\u308b\u306e\u304c\u3088\u304f\u3042\u308b\u4f5c\u696d\u3060\u3068\u601d\u3046\u306e\u3067\u30fb\u30fb<\/p>\n<p>\u3053\u3053\u3067\u306fINCREMENT_COUNTER\u3001DECREMENT_COUNTER\u3068\u3044\u3046\u3000action\u306b<br \/>\n\u7d50\u3073\u3064\u3051\u3066\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u3069\u3046\u3084\u3063\u3066action\u3092\u547c\u3073\u51fa\u3059\u304b\u3068\u3044\u3046\u3068\u3001\u6b21\u306b\u8aac\u660e\u3059\u308b\u3001script\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u3001<br \/>\nmapActions \u3068\u3057\u3066\u3001\u3053\u308c\u3089\u3092\u5b9a\u7fa9\u3057\u3066\u3084\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3046\u3059\u308b\u3068\u3001\u30d5\u30ed\u30f3\u30c8\u304b\u3089\u3001\u30b9\u30c8\u30a2\u306eaction\u3092\u547c\u3073\u51fa\u305b\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n<template><\/p>\n<div>\n<h3>This is Counter App<\/h3>\n<h4>{{counter}}<\/h4>\n<p>    <button @click=\"INCREMENT_COUNTER\">+++<\/button><br \/>\n    <button @click=\"DECREMENT_COUNTER\">&#8212;<\/button><\/p><\/div>\n<p><\/template><br \/>\n[\/bash]<\/p>\n<h3>script\u30bb\u30af\u30b7\u30e7\u30f3<\/h3>\n<p>\u8868\u793a\u7cfb\u306f computed\u306e\u90e8\u5206\u3067\u3001mapGetters<br \/>\n\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u7cfb\u306f methods\u306e\u90e8\u5206\u3067\u3001 mapActions\u3068\u3057\u3066\u3001\u30b9\u30c8\u30a2\u306eaction\u306b\u5f15\u304d\u6e21\u3059\u3002<\/p>\n<p>[bash]<br \/>\n<script>\nimport { INCREMENT_COUNTER, DECREMENT_COUNTER, GET_COUNTER } from '..\/store\/mutation-type'\nimport { mapGetters, mapActions} from 'vuex'<\/p>\n<p>export default {\n  name: 'counter',\n  computed: {\n    ...mapGetters('counter', {\n      counter: GET_COUNTER\n    })\n  },\n  methods: {\n    ...mapActions('counter', [\n      INCREMENT_COUNTER,\n      DECREMENT_COUNTER\n    ])\n  }<\/p>\n<p>}\n<\/script><\/p>\n<p>[\/bash]<\/p>\n<p>\u3053\u308c\u3067\u3081\u3067\u305f\u304f\u7d42\u4e86\u3067\u3001\u3042\u3068\u306frouter\u306b\u30ab\u30a6\u30f3\u30bf\u30fc\u7528\u306e\u30da\u30fc\u30b8\u3092\u5b9a\u7fa9\u3059\u308b\u306e\u307f\u3067\u3059\u3002<\/p>\n<p>src\/router\/index.js<\/p>\n<p>[bash]<br \/>\nimport Vue from &#8216;vue&#8217;<br \/>\nimport Router from &#8216;vue-router&#8217;<br \/>\nimport HelloWorld from &#8216;@\/components\/HelloWorld&#8217;<br \/>\n+ import Counter from &#8216;@\/components\/Counter&#8217;<\/p>\n<p>Vue.use(Router)<\/p>\n<p>export default new Router({<br \/>\n  routes: [<br \/>\n    {<br \/>\n      path: &#8216;\/&#8217;,<br \/>\n      name: &#8216;HelloWorld&#8217;,<br \/>\n      component: HelloWorld<br \/>\n    },<br \/>\n+    {<br \/>\n+      path: &#8216;\/counter&#8217;,<br \/>\n+     name: &#8216;Counter&#8217;,<br \/>\n+      component: Counter<br \/>\n+   }<br \/>\n  ]<br \/>\n})<br \/>\n[\/bash]<\/p>\n<p>npm run dev\u3000\u3057\u3066<br \/>\n\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u4ee5\u4e0b\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u304c\u8d77\u52d5\u3059\u308c\u3070OK\u3002<\/p>\n<p>http:\/\/localhost:8080\/#\/counter<\/p>\n<p>\u51fa\u6765\u4e0a\u304c\u308a\u306e\u30bd\u30fc\u30b9\u30c4\u30ea\u30fc<br \/>\n<a href=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-08-at-20.54.32.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-08-at-20.54.32.png\" alt=\"Screen Shot 2018-06-08 at 20.54.32\" width=\"301\" height=\"436\" class=\"alignnone size-full wp-image-1837\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vue.js\u59cb\u3081\u307e\u3057\u305f\u3002\u3055\u3063\u3071\u308a\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3088\u3046\u3084\u304f\u300c\u3044\u308d\u306f\u300d\u306f \u63b4\u3081\u3066\u304d\u305f\u306e\u3067\u3001vuex\u3092\u4f7f\u3063\u3066\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002 store\u3092module\u3067\u5206\u5272\u3057\u3066\u3001\u4e2d\u898f\u6a21\u304f\u3089\u3044\u306e\u30a2\u30d7\u30ea\u306a\u3089\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u306a\u611f\u3058\u306b\u4ed5\u4e0a\u3052\u3066\u307f\u307e\u3057\u305f\u3002 \u3068\u306b\u304b\u304f Vuex\u304c\u3084\u3084\u3053\u3057\u3044\u3068\u3044\u3046\u304b\u3001\u3069\u3046\u3044\u3046\u69cb\u9020\u3067\u3001\u3069\u3046\u5229\u7528\u3059\u308b\u306e\u304b\u304c\u96e3\u3057\u3044\u3002 \u3053\u308c\u306b\u6163\u308c\u308b\u306e\u304c\u4e00\u756a\u306e\u30ad\u30e2\u3067\u3059\u3002 \u51fa\u6765\u4e0a\u304c\u308a\u306e\u30a4\u30e1\u30fc\u30b8 \u30e1\u30c1\u30e3\u30e1\u30c1\u30e3\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u304c\u3001\u3053\u3093\u306a\u611f\u3058\u3002 \uff0b\uff0b\uff0b\u3092\u30af\u30ea\u30c3\u30af\u3067\u3001\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3001\u30fc\u30fc\u30fc\u3067\u30c7\u30af\u30ea\u30e1\u30f3\u30c8\u3002 \u73fe\u5728\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u304c\u300c\uff15\u300d Vue.js\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb [bash] $ npm install -g vue-cli [\/bash] sudo \u3092\u3064\u3051\u305f\u65b9\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210 [bash] $ cd ~\/Document $ vue init webpack vue1st [\/bash] \u8cea\u554f\u5f62\u5f0f\u3067 \u3053\u308c\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u304b\uff1f\u306a\u3069\u805e\u304b\u308c\u308b\u306e\u3067 eslint\u3092\u9664\u3044\u3066\u306f\u3001\u3059\u3079\u3066 Enter\u30ad\u30fc\u9023\u6253\u3067OK\u3060\u3068\u601d\u3046\u3002 eslint\u5165\u308c\u308b\u3068\u3001\u69cb\u6587\u30c1\u30a7\u30c3\u30af\u304c\u3084\u305f\u3089\u3046\u308b\u3055\u304f\u306a\u308b\u306e\u3067\u3001\u3053\u308c\u306f\u300cn\u300d\u3067\u5916\u3059\u306e\u304c\u30aa\u30b9\u30b9\u30e1\u3002 Vuex\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb [bash] $ cd vue1st $ npm install &#8211;Save vuex [\/bash] Store\u306e\u4f5c\u6210\u3068 main.js\u3078\u306e\u767b\u9332 [bash] $ mkdir src\/store $ nano src\/store\/index.js [\/bash] \u6700\u521d\u306f\u8a33\u304c\u308f\u304b\u3089\u3093\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u8efd\u304f\u8aac\u660e\u3002 Vuex\u306f Vue.js\u3067\u4f5c\u308bSPA\uff08\u30b7\u30f3\u30b0\u30eb\u30da\u30fc\u30b8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff09\u306e \u5168\u30b9\u30c6\u30fc\u30c8\u3092\u4e00\u62ec\u3057\u3066store\u3068\u3057\u3066\u3001\u7ba1\u7406\u3057\u307e\u3059\u3002 \u307e\u305a\u3001Vue.js\u3068Vuex\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u3001\u6b21\u306b Vue.js\u304b\u3089Vuex\u3092\u5229\u7528\u3057\u307e\u3059\u3088\u3068\u3059\u308b\u3002 \u3067\u3001\u30a2\u30d7\u30ea\u3067\u552f\u4e00\u306estore\u3092\u4f5c\u3063\u3066\u3001\u305d\u306estore\u3067\u5229\u7528\u3059\u308bmodules\u3092\u5ba3\u8a00\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u3053\u3053\u3067\u306f\u3000&#8217;counter&#8217;: counter \u306e\u90e8\u5206\u3067\u3059\u3002 \u540c\u4e00\u30d5\u30a1\u30a4\u30eb\u306b\u3057\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u898f\u6a21\u304c\u5927\u304d\u304f\u306a\u308b\u3068\u898b\u901a\u3057\u304c\u60aa\u304f\u306a\u308b\u306e\u3067\u3001 \u30d5\u30a1\u30a4\u30eb\u3092\u5206\u5272\u3057\u3066\u304a\u304d\u307e\u3059\u3002 \u3067\u3001\u6700\u5f8c\u306b store\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3068\u3057\u3066export\u3002 src\/store\/index.js [bash] import Vue from &#8216;vue&#8217; import Vuex from &#8216;vuex&#8217; import counter from &#8216;.\/counter&#8217; Vue.use(Vuex) const store = new Vuex.Store({ modules :{ &#8216;counter&#8217;: counter, } }) export default store [\/bash] main.js\u3078\u306e\u767b\u9332 \u300c\uff0b\u300d\u3068\u306a\u3063\u3066\u3044\u308b\u884c\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002 [bash] import Vue from &#8216;vue&#8217; import App from &#8216;.\/App&#8217; import router from &#8216;.\/router&#8217; + import store from &#8216;.\/store&#8217; Vue.config.productionTip = false \/* eslint-disable no-new *\/ new Vue({ el: &#8216;#app&#8217;, + store, router, components: { App }, template: &#8216;&#8216; }) [\/bash] \u30ab\u30a6\u30f3\u30bf\u30fc\u306e\u30b9\u30c8\u30a2\u3092\u4f5c\u6210 \u3053\u3053\u304c\u591a\u5206\u4e00\u756a\u96e3\u3057\u3044\u3002 \u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u306e\u8981\u4ef6\u306f\u3001 \uff11.\u73fe\u5728\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u5024\u3092\u53d6\u5f97\u3067\u304d\u308b \uff12.\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3067\u304d\u308b \uff13.\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\u30c7\u30af\u30ea\u30e1\u30f3\u30c8\u3067\u304d\u308b \u30b9\u30c8\u30a2\u306b\u4fdd\u6301\u3059\u308b\u3079\u304d\u5024\u306f\u3001 \u30ab\u30a6\u30f3\u30bf\u30fc\u5024\uff11\u3064\u306e\u307f\u3002 \u3053\u306e\u6761\u4ef6\u304c\u63c3\u3063\u305f\u3068\u3053\u308d\u3067\u3001 src\/store\/mutation-type.js\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002 mutation\u3068\u306f\u5909\u5316\u3059\u308b\u3068\u3044\u3046\u610f\u5473\u3002 \u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u3067\u3001Vuex\u3067\u3044\u3046\u3068\u3001 \u30ab\u30a6\u30f3\u30bf\u30fc\u3092\u5897\u6e1b\u3055\u305b\u308b\u3053\u3068\u304c mutation \u3053\u308c\u3092\u5b9a\u6570\u5b9a\u7fa9\u3057\u307e\u3059\u3002 \u3067\u3001\u5909\u5316\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u73fe\u5728\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206\u3082 \u5b9a\u6570\u5b9a\u7fa9\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u3087\u3046\u3002\uff08\u53b3\u5bc6\u306b\u306fmutation\u3067\u306f\u306a\u3044\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u5206\u304b\u308c\u308b\u3068\u3084\u3084\u3053\u3057\u3044\u306e\u3067 \u307e\u3068\u3081\u307e\u3059\u3002\uff09 src\/store\/mutation-type.js [bash] export const INCREMENT_COUNTER = &#8216;INCREMENT_COUNTER&#8217; export const DECREMENT_COUNTER = &#8216;DECREMENT_COUNTER&#8217; export const GET_COUNTER = &#8216;GET_COUNTER&#8217; [\/bash] \u3067\u306f\u3001\u3053\u306e\u5b9a\u6570\u3092\u4f7f\u3063\u3066\u3001\u30ab\u30a6\u30f3\u30bf\u30fc\u306eStore\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002 \u3053\u308c\u304c\u975e\u5e38\u306b\u6163\u308c\u308b\u307e\u3067\u96e3\u3057\u3044\u3002\u3002\u3002 \u6700\u521d\u306econst\u5ba3\u8a00\u3068\u3001namespaced\u306f\u304a\u6c7a\u307e\u308a\u306a\u306e\u3067\u3001\u3053\u3093\u306a\u611f\u3058\u306a\u3093\u3060\u306a\u3068\u899a\u3048\u308b\u3002 \u6b21\u306estate\/actions\/mutations\/getters \u3053\u3053\u304c\u96e3\u3057\u3044\uff01\uff01 \u305d\u306e\u4e2d\u3067\u3082state\u306f\u30b7\u30f3\u30d7\u30eb\u3002 \u3053\u306e\u30b9\u30c8\u30a2\u3067\u4fdd\u6301\u3057\u305f\u3044\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u5834\u6240\u3002\u30ab\u30a6\u30f3\u30bf\u30fc\u30a2\u30d7\u30ea\u306a\u306e\u3067 \u4fdd\u6301\u3059\u308b\u306e\u306f\u30ab\u30a6\u30f3\u30bf\u30fc\u306e\u5024\u4e00\u500b\u3002\u305d\u308c\u3092\u5b9a\u7fa9\u3057\u3066\u3001\u521d\u671f\u5024\u3092\u30bb\u30c3\u30c8\u3057\u307e\u3059\u3002 actions\u306f \u3053\u308c\u304b\u3089state\u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u3093\u3060\u3051\u3069\u3001\u305d\u306e\u524d\u51e6\u7406\u3092\u3059\u308b\u5834\u6240\u3001\u3050\u3089\u3044\u306b\u6349\u3048\u3066\u304a\u304f\u3068\u826f\u3044\u3002 \u57fa\u672c\u3001\u753b\u9762\u4e0a\u304b\u3089\u306e\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u3068\u7d50\u3073\u3064\u304f\u5834\u6240\u3060\u3068\u8003\u3048\u3066\u304f\u3060\u3055\u3044\u3002 \u3067\u3001action\u3067\u4f55\u3089\u304b\u306e\u524d\u51e6\u7406\u3092\u3057\u3066\u3001mutation\u3092\u30b3\u30df\u30c3\u30c8\u3057\u307e\u3059\u3002 mutation\u3067\u5b9f\u969b\u306e\u30b9\u30c8\u30a2\u306e\u5024\u3092\u66f8\u304d\u63db\u3048\u307e\u3059\u3002mutation\u3092\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u3001\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u306a\u3069\u3082 \u30bb\u30c3\u30c8\u3057\u3066\u3084\u308a\u307e\u3059\u3002\uff08\u4eca\u56de\u306e\u5834\u5408\u3001\u30ab\u30a6\u30f3\u30bf\u30fc\u306a\u306e\u3067\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u306f\u306a\u3044\uff09 \u3042\u3001\u3067\u3001\u5909\u306a\u66f8\u304d\u65b9\u306a\u306e\u304c\u3001actions\u306e\u95a2\u6570\u5ba3\u8a00\u3002 \u5b9a\u6570\u3092[\u5b9a\u6570]\u3000\u3068\u3057\u3066\u3084\u308b\u3068\u95a2\u6570\u540d\u3068\u3057\u3066\u5229\u7528\u3067\u304d\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u5229\u7528\u3057\u3066\u307e\u3059\u3002 \u52a0\u3048\u3066\u52a0\u3048\u3066\u3001Vue\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u3001\u3000mapActions\u3068\u3057\u3066\u3001\u547c\u3073\u51fa\u3057\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002 mutation\u306f\u7d14\u7c8b\u306b\u5f15\u6570\u306e state\u3068\u3001payload\u3092\u4f7f\u3063\u3066\u3001\u5b9f\u969b\u306estate\u3067\u4fdd\u6301\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u66f8\u304d\u63db\u3048\u308b\u51e6\u7406\u3092\u3057\u307e\u3059\u3002 mutation\u81ea\u4f53\u306f\u76f4\u63a5\u547c\u3073\u51fa\u3055\u308c\u308b\u3053\u3068\u306f\u306a\u304f\u3001action\u7d4c\u7531\u306a\u3069\u3067\u3001commit\u3055\u308c\u3066\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002 \u6700\u5f8c\u3001getters \u3053\u308c\u306f\u3001store\u306e\u5024\u3092\u8aad\u307f\u51fa\u3059\u305f\u3081\u306e\u5834\u6240\u3002 \u3053\u308c\u3092\u5b9a\u7fa9\u3057\u3066\u304a\u304f\u3068\u3001Vue\u30d5\u30a1\u30a4\u30eb\u304b\u3089 mapGetters\u3067 \u30b9\u30c8\u30a2\u60c5\u5831\u3092\u8aad\u307f\u51fa\u305b\u307e\u3059\u3002 [bash] import {INCREMENT_COUNTER, DECREMENT_COUNTER, GET_COUNTER} from &#8216;.\/mutation-type&#8217; const counter = { namespaced: true, state: { counter_value: 0 }, actions: { [INCREMENT_COUNTER] ({commit, state, rootState}) { commit(INCREMENT_COUNTER, {}) }, [DECREMENT_COUNTER] ({commit, state, rootState}) { commit(DECREMENT_COUNTER, {}) } }, mutations:{ [INCREMENT_COUNTER] (state, payload) { state.counter_value += 1 }, [DECREMENT_COUNTER] (state, payload) { state.counter_value -= 1 } }, getters:{ [GET_COUNTER] (state, getters, rootState) { return state.counter_value } } } export default counter [\/bash] \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306e\u4f5c\u6210 \u62e1\u5f35\u5b50vue\u30d5\u30a1\u30a4\u30eb\u306f\uff13\u3064\u306e\u90e8\u5206\u3067\u69cb\u6210\u3055\u308c\u307e\u3059\u3002 \u30fb\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u308b html \u30fb\u5b9f\u884c\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8 \u30fbCSS CSS\u306f\u666e\u901a\u306eHTML\u3068\u540c\u3058\u306a\u306e\u3067\u3001\u6700\u521d\u306e\uff12\u3064\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002 [bash] This is Counter App {{counter}} +++ &#8212; [\/bash] \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 \u4f55\u3089\u304b\u306e\u5909\u6570\u5024\u3092\u8868\u793a\u3057\u305f\u3044\u3068\u3053\u308d\u306f {{\u5909\u6570\u540d}} \u3068\uff12\u91cd\u62ec\u5f27\u3067\u304f\u304f\u3063\u3066\u3068\u3057\u307e\u3059\u3002 @click\u306a\u3069\u306f\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\u5834\u6240\u3067\u3001 \u4e0d\u601d\u8b70\u306a\u69cb\u6587\u306a\u306e\u3067\u3059\u304c \u30c0\u30d6\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067 methods\u306e\u4e2d\u306b\u5b9a\u7fa9\u3055\u308c\u305f\u95a2\u6570\u540d\u3092\u6587\u5b57\u3068\u3057\u3066\u5b9a\u7fa9\u3057\u307e\u3059\u3002 \u95a2\u6570\u306b\u5f15\u6570\u304c\u3042\u308b\u5834\u5408\u3082\u3001\u5168\u90e8\u6587\u5b57\u3068\u3057\u3066\u8a18\u8ff0\u3057\u3061\u3083\u3046\u611f\u3058\u3067\u3059\u3002 \uff08\u3061\u3087\u3063\u3068\u5909\u308f\u3063\u3066\u307e\u3059\u306d\u30fb\u30fb\u30fb\u30fb&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[2,1],"tags":[98],"class_list":{"0":"post-1834","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-2","7":"category-1","8":"tag-vue-js"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1834"}],"version-history":[{"count":3,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1834\/revisions"}],"predecessor-version":[{"id":1839,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1834\/revisions\/1839"}],"wp:attachment":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}