{"id":9130,"date":"2018-12-23T15:34:34","date_gmt":"2018-12-23T06:34:34","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=9130"},"modified":"2018-12-23T15:34:34","modified_gmt":"2018-12-23T06:34:34","slug":"vue-js%e3%81%a7spa%e3%80%81vuex%e4%bd%bf%e7%94%a8%e3%81%99%e3%82%8b%e3%81%aa%e3%82%89-nuxt-js%e3%81%8c%e8%b6%85%e7%b5%b6%e4%be%bf%e5%88%a9%e3%81%aa%e4%bb%b6%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=9130","title":{"rendered":"Vue.js\u3067SPA\u3001Vuex\u4f7f\u7528\u3059\u308b\u306a\u3089 Nuxt.js\u304c\u8d85\u7d76\u4fbf\u5229\u306a\u4ef6\u3002"},"content":{"rendered":"<p><a href=\"https:\/\/ja.nuxtjs.org\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9141\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/12\/e109c288e4f1a5b83e738e89660a1a86.png\" alt=\"\" width=\"504\" height=\"344\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/12\/e109c288e4f1a5b83e738e89660a1a86.png 832w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/12\/e109c288e4f1a5b83e738e89660a1a86-300x205.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/12\/e109c288e4f1a5b83e738e89660a1a86-768x524.png 768w\" sizes=\"auto, (max-width: 504px) 100vw, 504px\" \/><\/a><\/p>\n<p>\u3069\u3082\u3067\u3059\u3002<\/p>\n<p>Vue.js\u306f\u304b\u308c\u3053\u308c\u3001\u4f7f\u7528\u3057\u30662\u5e74\u304f\u3089\u3044\u7d4c\u3064\u306e\u304b\u3082\u3001\u7d4c\u305f\u306a\u3044\u304b\u3082\u3002<\/p>\n<p>\u30ac\u30c3\u30c4\u30ea\u3068\u4f7f\u7528\u3057\u3066\u304d\u305f\u306e\u3067\u3059\u304c\u3001\u4e3b\u306bweb\u30b2\u30fc\u30e0\u4f5c\u6210\u3067\u306e\u4f7f\u7528\u3067\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u3001\u6240\u8b02\u4e00\u822c\u7684\u306a\u300c<strong>Web\u30b5\u30fc\u30d3\u30b9\uff08Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff09<\/strong>\u300d\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3042\u3063\u3066\u3001\u8272\u3005\u6f01\u3063\u3066\u306f\u898b\u305f\u3082\u306e\u306e<\/p>\n<p>\u3084\u3063\u3071\u308aVue.js\u304c\u5b9f\u88c5\u3082\u697d\u3060\u306a\u3068\u8a00\u3046\u3053\u3068\u3067\u3001\u3069\u3046\u305b\u306a\u3089\u30e2\u30c0\u30f3\u306a\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u5b9f\u88c5\u304c\u826f\u3044\u306a\u3068\u601d\u3063\u3066<\/p>\n<p>\u6539\u3081\u3066Nuxt.js\u3092\u30ac\u30c3\u30c4\u30ea\u89e6\u308a\u59cb\u3081\u305f\u306e\u3067\u3059\u304c\u3001\u3084\u3063\u3071\u308a\u300c<strong>\u8d85\u7d76\u4fbf\u5229<\/strong>\u300d\u3067\u3059\u306d\uff01<\/p>\n<p>\u524d\u56de\u3001<a href=\"https:\/\/www.webcyou.com\/?p=8221\">\u3053\u3061\u3089<\/a>\u306e\u8a18\u4e8b\u3067\u3001\u8efd\u304f\u7d39\u4ecb\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u306e\u3067\u3059\u304c\uff08\u3082\u30461\u5e74\u4ee5\u4e0a\u524d\u306a\u306e\u304bw\uff09\u3001\u6539\u3081\u3066\u4f7f\u7528\u3057\u59cb\u3081\u305f\u306e\u3067\u3059\u304c\u3001\u3084\u306f\u308a<strong>\u4fbf\u5229<\/strong>\u3067\u3059\u306d\u3002<\/p>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u30822.3.4\u3068\u3044\u3046\u4e8b\u3067\u30011\u5e74\u524d\u3088\u308a\u3082\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u4e0a\u304c\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>&nbsp;<\/p>\n<p>\u4eca\u307e\u3067\u3042\u307e\u308a\u4f7f\u7528\u3057\u3066\u3053\u306a\u304b\u3063\u305f\u306e\u306f\u3001\u3084\u306f\u308aWeb\u30b2\u30fc\u30e0\u3068\u3082\u306a\u308b\u3068\u30011\u753b\u9762\u3067\u591a\u3051\u308c\u307020\u500b\u304f\u3089\u3044API\u306e\u975e\u540c\u671f\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u767a\u751f\u3057\u305f\u308a\u3001<\/p>\n<p>\u30a4\u30f3\u30bf\u30e9\u30af\u30b7\u30e7\u30f3\u306e\u70ba\u3001\u6050\u308d\u3057\u304fDOM\u3092\u52d5\u304b\u3057\u305f\u308a\u3001\u52ff\u8ad6\u753b\u9762\u306e\u72b6\u614b\u7ba1\u7406\u304c\u5fc5\u8981\u3068\u306a\u3063\u3066\u304d\u305f\u308a\u3057\u3066\uff08\u30b9\u30c6\u30fc\u30c8\u30de\u30b7\u30fc\u30f3\u3092\u5229\u7528\u3057\u305f\u308a\uff09\u7d30\u304b\u3044\u8abf\u6574\u304c\u591a\u3005\u5fc5\u8981\u3068\u3055\u308c\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u4e00\u822c\u7684\u306a\u300c<strong>Web\u30b5\u30fc\u30d3\u30b9\uff08Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff09<\/strong>\u300d\u5411\u3051\u306e\u30d5\u30eb\u30b9\u30bf\u30c3\u30af\u306a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3060\u3068\u4f7f\u7528\u3057\u306a\u3044\u4f59\u5206\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5165\u3063\u3066\u304d\u305f\u308a\u3059\u308b\u306e\u3067\u3001node\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u500b\u5225\u3067\u9078\u5b9a\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3063\u305f\u308a\u3057\u3001\u30ea\u30bd\u30fc\u30b9\u3082\u6700\u5c0f\u9650\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3082\u5171\u901a\u8a8d\u8b58\u304c\u6301\u3066\u308b\u3001\u67af\u308c\u305f\u8a2d\u8a08\u3067\u3042\u308b<strong>OOP\uff08\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\uff09<\/strong>\u306a\u3069\u3092\u7528\u3044\u3066\u4f5c\u6210\u3057\u305f\u307b\u3046\u304c\u7121\u96e3\u306b\u5236\u4f5c\u3092\u9032\u3081\u3089\u308c\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>OOP\uff08\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\uff09\u3068\u8a00\u3048\u3070\u3001\u30af\u30e9\u30b9\u306b\u300c\u72b6\u614b\u300d\u300c\u51e6\u7406\u300d\u3092\u6301\u3063\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u758e\u7d50\u5408\u306e\u95a2\u4fc2\u3067\u8a2d\u8a08\u3055\u308c\u3066\u3044\u304f\u306e\u3067\u3059\u304c\u3001<\/p>\n<p>\u901a\u5e38\u306e\u300c<strong>Web\u30b5\u30fc\u30d3\u30b9\uff08Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff09<\/strong>\u300d\u306e\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u5b9f\u88c5\u3067\u7528\u3044\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u5197\u9577\u306b\u611f\u3058\u3066\u3057\u307e\u3046\u3053\u3068\u3082\u3057\u3070\u3057\u3070\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>API\u901a\u4fe1\u3082\u753b\u9762\u306b\u5bfe\u3057\u30661\u30012\u500b\u3002\u591a\u304f\u3066\u30825\u500b\u3068\u304b\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u305d\u306e\u69d8\u306a\u5834\u5408\u30011\u65b9\u5411\u30c7\u30fc\u30bf\u30d5\u30ed\u30fc\u8a2d\u8a08\u3067\u3042\u308bFlux\u3084Redux\u3001Vue js\u3067\u306f Vuex\u306e\u8a2d\u8a08\u3092\u7528\u3044\u308b\u3068\u3001\u5927\u304d\u3059\u304e\u305a\u3001\u6bd4\u8f03\u7684\u30b7\u30f3\u30d7\u30eb\u306b\u72b6\u614b\u7ba1\u7406\u304c\u884c\u3048\u308b\u3088\u3046\u306b\u611f\u3058\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3001\u307e\u3041\u3001\u524d\u7f6e\u304d\u306f\u3055\u3066\u304a\u304d\u3001\u300c<strong>Nuxt.js<\/strong>\u300d\u304c\u3001\u300c<strong>\u975e\u5e38\u306b\u697d\u3060<\/strong>\u3002\u300d\u3068\u611f\u3058\u305f\u3068\u3053\u308d\u3068\u3001\u6ce8\u610f\u70b9\u3092\u8efd\u304f\u30d4\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u300c<strong>Nuxt.js<\/strong>\u300d\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306a\u3069\u306f\u3001\u516c\u5f0f\u306e<a href=\"https:\/\/ja.nuxtjs.org\/guide\/installation\/\" target=\"_blank\" rel=\"noopener\">\u3053\u3061\u3089<\/a>\u3092\u53c2\u8003\u306b\u3001\u5272\u611b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4>webpack\u3001node\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u304c\u8d85\u7d76\u697d<\/h4>\n<p>\u901a\u5e38 Vue js\u3092\u4f7f\u7528\u3057\u3066 node\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3068\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u5897\u3048\u3066\u3044\u304d\u3001\uff08\u4e00\u90e8\uff09\u7ba1\u7406\u3082\u8f9b\u304f\u306a\u3063\u3066\u304d\u307e\u3059\u3002\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n...\r\n\"autoprefixer\": \"9.3.1\",\r\n\"aws-sdk\": \"2.353.0\",\r\n\"babel-eslint\": \"10.0.1\",\r\n\"babel-loader\": \"8.0.4\",\r\n\"babel-plugin-lodash\": \"3.3.4\",\r\n\"browser-sync\": \"2.26.3\",\r\n\"cfonts\": \"2.2.3\",\r\n\"chalk\": \"2.4.1\",\r\n\"check-engines\": \"1.5.0\",\r\n\"chokidar\": \"2.0.4\",\r\n\"colors\": \"1.3.2\",\r\n\"commander\": \"2.19.0\",\r\n\"concurrently\": \"4.0.1\",\r\n\"css-loader\": \"1.0.1\",\r\n\"eslint\": \"5.9.0\",\r\n\"eslint-config-airbnb-base\": \"13.1.0\",\r\n\"eslint-config-prettier\": \"3.3.0\",\r\n\"eslint-plugin-import\": \"2.14.0\",\r\n\"eslint-plugin-prettier\": \"3.0.0\",\r\n\"fs-extra\": \"7.0.1\",\r\n\"glob\": \"7.1.3\",\r\n\"html-loader\": \"0.5.5\",\r\n\"html-webpack-plugin\": \"3.2.0\",\r\n\"htmlhint\": \"0.10.1\",\r\n\"husky\": \"1.1.3\",\r\n\"json-server\": \"0.14.0\",\r\n\"lint-staged\": \"8.0.4\",\r\n\"lodash-webpack-plugin\": \"0.11.5\",\r\n\"mini-css-extract-plugin\": \"0.4.4\",\r\n\"node-sass\": \"4.10.0\",\r\n\"optimize-css-assets-webpack-plugin\": \"5.0.1\",\r\n\"postcss-loader\": \"3.0.0\",\r\n\"postcss-syntax\": \"0.34.0\",\r\n\"prettier\": \"1.15.2\",\r\n\"prettier-stylelint-formatter\": \"0.5.1-beta.2\",\r\n\"progress-bar-webpack-plugin\": \"1.11.0\",\r\n\"pug\": \"2.0.3\",\r\n\"pug-loader\": \"2.4.0\",\r\n\"sass-loader\": \"7.1.0\",\r\n\"shelljs\": \"0.8.2\",\r\n\"style-loader\": \"0.23.1\",\r\n\"stylelint\": \"9.8.0\",\r\n\"stylelint-config-prettier\": \"4.0.0\",\r\n\"stylelint-config-recommended-scss\": \"3.2.0\",\r\n\"stylelint-scss\": \"3.4.0\",\r\n\"uglifyjs-webpack-plugin\": \"2.0.1\",\r\n\"webpack\": \"4.25.1\",\r\n\"webpack-build-notifier\": \"0.1.30\",\r\n\"webpack-bundle-analyzer\": \"3.0.3\",\r\n\"webpack-cli\": \"3.1.2\",\r\n\"webpack-merge\": \"4.1.4\",\r\n\"axios\": \"0.18.0\",\r\n\"dom-helpers\": \"3.4.0\",\r\n\"lodash-es\": \"4.17.11\",\r\n\"vue\": \"2.5.17\",\r\n\"vue-class-component\": \"6.3.2\",\r\n\"vue-iscroll-view\": \"1.0.3\",\r\n\"vue-touch\": \"2.0.0-beta.4\",\r\n\"ts-loader\": \"4.1.0\",\r\n\"ts-node\": \"^7.0.0\",\r\n\"tslint\": \"^5.9.1\",\r\n\"tslint-config-airbnb\": \"^5.8.0\",\r\n\"tslint-config-prettier\": \"^1.10.0\",\r\n\"tslint-plugin-prettier\": \"^1.3.0\",\r\n\"typescript\": \"2.8.1\",\r\n\"typings\": \"^2.1.1\",\r\n\"webidl-conversions\": \"^4.0.2\",\r\n\"iscroll\": \"^5.2.0\",\r\n\"countdown-timer-js\": \"^1.0.3\",\r\n\"vue-iscroll-view\": \"^1.0.3\",\r\n...\r\n<\/pre>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u6bce\u306b\u8003\u3048\u308b\u306e\u3092\u5c11\u3005\u8f9b\u304f\u306a\u3063\u3066\u304f\u308b\u306e\u3067\u3059\u304c\u3001\u300c<strong>Nuxt.js<\/strong>\u300d\u3060\u3068\u3001\u3053\u306e\u8fba\u3082\u6700\u521d\u306ecreate-nuxt-app\u3067\u9078\u629e\u3059\u308c\u3070\u3001 \u300c<strong>Nuxt.js<\/strong>\u300d\u5074\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u300c<strong>Nuxt.js<\/strong>\u300d\u5185\u3067\u9589\u3058\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u7ba1\u7406\u3082\u697d\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u5197\u9577\u306b\u306a\u308a\u3084\u3059\u3044 webpack\u306e\u8a2d\u5b9a\u30fb\u30a8\u30b3\u30b7\u30b9\u30c6\u30e0\u306a\u3069\u3001\u30d3\u30eb\u30c9\u30d7\u30ed\u30bb\u30b9\u3082\u300c<strong>Nuxt.js<\/strong>\u300d\u304c\u96a0\u853d\uff08\u30e9\u30c3\u30d7\uff09\u3057\u3066\u304f\u308c\u3066\u3066\u8d85\u7d76\u697d\u3067\u3059\u3002<\/p>\n<p>\u3068\u306f\u8a00\u3048\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u306f\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u8a2d\u5b9a\u3092\u884c\u3046\u5834\u5408\u306f\u3001\u3059\u3079\u3066\u300c<strong>nuxt.config.js<\/strong>\u300d\u306b\u8a2d\u5b9a\u3059\u308c\u3070\u30aa\u30c3\u30b1\u30fc\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u300c<strong>Atomic Design<\/strong>\u300d\u306e<strong>CSS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<\/strong>\u3067\u3042\u308b\u300c<strong>atomic-package<\/strong>\u300d\u3092\u4f7f\u7528\u3057\u305f\u3044\u5834\u5408\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>npm install\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ npm install @atomic-package\/css<\/pre>\n<p>nuxt\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u300c<strong>nuxt.config.js<\/strong>\u300d\u3092\u4fee\u6b63<\/p>\n<p>nuxt.config.js<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\/*\r\n** Global CSS\r\n*\/\r\ncss: &#x5B;\r\n  '@\/@atomic-package\/css\/dist\/atomic-package.css',\r\n  '...\r\n],<\/pre>\n<p>\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3055\u308c\u308b\u8981\u7d20\u306e\u8a18\u8ff0\u3002<\/p>\n<p>Vue\u30d5\u30a1\u30a4\u30eb<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;p class=&quot;btn&quot; \/&gt;<\/pre>\n<p>\u3053\u308c\u3067\u3082\u3046\u3001Atomic Design \u30d9\u30fc\u30b9\u306e CSS\u30dc\u30bf\u30f3\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9136\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/12\/81570154e28da6db5ba788016ce03bc5.png\" alt=\"\" width=\"163\" height=\"43\" \/><\/p>\n<p>\u8d85\u7d76\u697d\u3067\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u8d85\u7d76\u697d<\/h4>\n<p>\u300c<strong>nuxt.config.js<\/strong>\u300d\u306e mode\u3067\u300cSPA\u300d\u304b\u300cSSR\u300d\u3092\u9078\u629e\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u3092 spa\u306b\u8a2d\u5b9a\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">mode: 'spa'<\/pre>\n<p>\u300cpages\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306e\u300cVue\u30d5\u30a1\u30a4\u30eb\uff08\u3007\u3007.vue\uff09\u300d\u306f\u3001\u300c<strong>Nuxt.js<\/strong>\u300d\u304c\u30da\u30fc\u30b8\u3068\u8a8d\u8b58\u3057\u3001\u81ea\u52d5\u7684\u306b<strong>Vue Router<\/strong>\u306e\u8a2d\u5b9a\u3092\u884c\u3063\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u69d8\u306b\u3001pages\/recipe \u304c\u3042\u308b\u3068\u3059\u308b\u3068<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9137\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/12\/30c87d95768badd2b41a18a8cbb4d964.png\" alt=\"\" width=\"177\" height=\"112\" \/><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">{\r\n  path: \"\/recipe\/detail\",\r\n  component: _24157e40,\r\n  name: \"recipe-detail\"\r\n},\r\n{\r\n  path: \"\/recipe\/edit\",\r\n  component: _52345939,\r\n  name: \"recipe-edit\"\r\n},\r\n{\r\n  path: \"\/recipe\/:id\",\r\n  component: _021e4a4a,\r\n  name: \"recipe-id\"\r\n}<\/pre>\n<p>\u3068\u8a00\u3063\u305f\u5177\u5408\u306b\u81ea\u52d5\u7684\u306b\u3001<strong>Vue Router<\/strong>\u306e\u8a2d\u5b9a\u3092\u884c\u3063\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u300c<strong>Nuxt.js<\/strong>\u300d\u306f\u3001_\u3007\u3007.vue \u3068\u3001\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u4ee5\u964d\u306e\u540d\u524d\u3092\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3068\u8a8d\u8b58\u3059\u308b\u3088\u3046\u3067\u3001<\/p>\n<p>\u81ea\u52d5\u7684\u306b\u300c<strong>params<\/strong>\u300d\u306b\u4ee3\u5165\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u4ed5\u7d44\u307f\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u30b5\u30af\u30c3\u3068SPA\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u3002<\/p>\n<p>\u5bfe\u8c61\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u300cpages\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306b\u4f5c\u6210\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u30ea\u30f3\u30af\u306e\u8a2d\u5b9a\u306f\u300cnuxt-link\u300d\u3067\u8a2d\u5b9a\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;nuxt-link to=&quot;\/recipe\/detail&quot;&gt;&lt;\/nuxt-link&gt;<\/pre>\n<p>id\u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u6e21\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300cname\u300d\u300cparams\u300d\u3092\u300c:to\u300d\u3067\u30d0\u30a4\u30f3\u30c9\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;nuxt-link :to=&quot;{ name: 'recipe-id', params: { id: recipe.id }}&quot;&gt;<\/pre>\n<p>\u308f\u3056\u308f\u3056\u3001Vue Router\u3082\u500b\u5225\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u306a\u304f\u3066\u826f\u3044\u306e\u3067\u3001\u975e\u5e38\u306b\u697d\u3067\u3059\u3002<\/p>\n<h4>Redux\u304c\u8d85\u7d76\u697d<\/h4>\n<p>  \u300c<strong>Nuxt.js<\/strong>\u300d\u3067\u306f\u3001\u300cstore\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u300c<strong>Vuex<\/strong>\u300d\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u8a8d\u8b58\u3057\u307e\u3059\u3002<\/p>\n<p>\u30cd\u30c3\u30c8\u3067\u3082\u3061\u3087\u3053\u3061\u3087\u3053\u898b\u304b\u3051\u308b\u306e\u3067\u3059\u304c\u3001store\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306b\u300cindex.js\u300d\u3092\u4f5c\u6210\u3057\u3001<\/p>\n<p>\u4ee5\u4e0b\u306e\u69d8\u306b\u8a18\u8ff0\u3002<\/p>\n<p><strong>\u30af\u30e9\u30b7\u30c3\u30af\u30e2\u30fc\u30c9\u8a18\u8ff0<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">const store = new Vuex.Store({\r\n  state: {\r\n    count: 0\r\n  },\r\n  mutations: {\r\n    increment (state) {\r\n      state.count++\r\n    }\r\n  }\r\n})<\/pre>\n<p>\u3068\u3053\u308c\u3089\u3001Vuex\u306e\u300c<strong>\u30af\u30e9\u30b7\u30c3\u30af\u30e2\u30fc\u30c9<\/strong>\u300d\u3067\u306e\u8a18\u8ff0\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u3067\u3082\u554f\u984c\u306a\u304f\u52d5\u4f5c\u3059\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u3088\u308a Nuxt\u3092\u4fbf\u5229\u306b\u6271\u3044\u305f\u3044\u306e\u3067\u3042\u308c\u3070<\/p>\n<p>\u300cnew Vuex.Store(..)\u300d\u306e\u8a18\u8ff0\u3082\u5fc5\u8981\u306a\u3044\u300c<strong>\u30e2\u30b8\u30e5\u30fc\u30eb\u30e2\u30fc\u30c9<\/strong>\u300d\u3092\u6d3b\u7528\u3059\u308b\u3068\u826f\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">export const state = () =&gt; ({\r\n  state: {\r\n    count: 0\r\n  }\r\n})\r\n\r\nexport const mutations = () =&gt; ({\r\n  increment (state) {\r\n    state.count++\r\n  }\r\n})<\/pre>\n<p>\u3053\u3061\u3089\u4f55\u304c\u4fbf\u5229\u304b\u3068\u3044\u3046\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u5358\u4f4d\u3067\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u3092\u884c\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>todo.js\u3092\u4f5c\u6210\u3057\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3002<\/p>\n<p><strong>store\/todos.js<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">export const state = () =&gt; ({\r\n  list: &#x5B;]\r\n})\r\n\r\nexport const mutations = {\r\n  add (state, text) {\r\n    state.list.push({\r\n      text: text,\r\n      done: false\r\n    })\r\n  },\r\n  remove (state, { todo }) {\r\n  state.list.splice(state.list.indexOf(todo), 1)\r\n  },\r\n  toggle (state, todo) {\r\n    todo.done = !todo.done\r\n  }\r\n}<\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30af\u30e9\u30b7\u30c3\u30af\u30e2\u30fc\u30c9\u306e\u8a18\u8ff0\u3068\u540c\u7b49\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u81ea\u52d5\u3067\u300cmodules\u300d\u3092\u4f5c\u6210\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u7ba1\u7406\u3082\u3057\u3084\u3059\u3044\u3067\u3059\u306d\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">new Vuex.Store({\r\n  state: () =&gt; ({\r\n    counter: 0\r\n  }),\r\n  mutations: {\r\n    increment (state) {\r\n      state.counter++\r\n    }\r\n  },\r\n  modules: {\r\n    namespaced: true,\r\n    todos: {\r\n      state: () =&gt; ({\r\n        list: &#x5B;]\r\n      }),\r\n      mutations: {\r\n        add (state, { text }) {\r\n          state.list.push({\r\n            text,\r\n            done: false\r\n          })\r\n        },\r\n        remove (state, { todo }) {\r\n          state.list.splice(state.list.indexOf(todo), 1)\r\n        },\r\n        toggle (state, { todo }) {\r\n          todo.done = !todo.done\r\n        }\r\n      }\r\n    }\r\n  }\r\n})<\/pre>\n<p>Vue\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u547c\u3073\u51fa\u3059\u5834\u5408<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">export default {\r\n  computed: {\r\n    todos () { return this.$store.state.todos.list }\r\n  },\r\n  methods: {\r\n    addTodo (e) {\r\n      this.$store.commit('todos\/add', e.target.value)\r\n      e.target.value = ''\r\n    },\r\n    ...mapMutations({\r\n      toggle: 'todos\/toggle'\r\n    })\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h4>component\u3068page\u306e\u9055\u3044<\/h4>\n<p>\u516c\u5f0f\u30b5\u30a4\u30c8\u3088\u308a\u5f15\u7528<\/p>\n<blockquote>\n<p>  components\u00a0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u306f Vue.js \u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u5165\u308c\u307e\u3059\u3002Nuxt.js \u306f\u00a0components\u00a0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e data \u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066\u306f\u624b\u3092\u52a0\u3048\u307e\u305b\u3093\uff08\u8a33\u6ce8: \u4e00\u65b9\u3001Nuxt.js \u306f\u00a0<code>pages<\/code>\u00a0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e data \u30e1\u30bd\u30c3\u30c9\u306b\u306f\u975e\u540c\u671f\u30c7\u30fc\u30bf\u3092\u6271\u3048\u308b\u3088\u3046\u624b\u3092\u52a0\u3048\u307e\u3059\uff09<\/p>\n<\/blockquote>\n<p>  \u3069\u3046\u3084\u3089\u3001components\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u901a\u5e38\u306eVue.js \u3068\u3057\u3066\u6271\u308f\u308c\u305d\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u3001pages\u4ee5\u4e0b\u3067\u4f7f\u7528\u3067\u304d\u308b\u975e\u540c\u671f\u30c7\u30fc\u30bf\u53d6\u5f97\u306e<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">export default {\r\n  asyncData (context) {\r\n    return { project: 'nuxt' }\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>\u306f\u3001component\u4ee5\u4e0b\u306eVue\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u4f7f\u7528\u3067\u304d\u306a\u3044\u69d8\u5b50\u3067\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001Store\u3092vue\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u300c<strong>this.$store<\/strong>\u300d\u3067\u53c2\u7167\u3067\u304d\u308b\u306e\u3082\u3001page\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306evue\u30d5\u30a1\u30a4\u30eb\u306b\u9650\u3089\u308c\u3066\u3044\u308b\u69d8\u5b50\u3067\u3059\u3002<\/p>\n<p>pages\u4ee5\u4e0b\u306eVue\u30d5\u30a1\u30a4\u30eb\u3067Store\u3092\u53c2\u7167<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">this.$store.state.user<\/pre>\n<p>\u3068\u3001\u8a00\u3063\u305f\u611f\u3058\u3067\u300c<strong>Nuxt.js<\/strong>\u300d\u306e\u4fbf\u5229\u3055\u3092\u3056\u3063\u3068\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u30d4\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001\u300c<strong>Nuxt.js<\/strong>\u300d\u3067\u3001\u30b5\u30af\u30c3\u3068SNS\u3092\u4f5c\u6210\u3067\u3082\u66f8\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002 Vue.js\u306f\u304b\u308c\u3053\u308c\u3001\u4f7f\u7528\u3057\u30662\u5e74\u304f\u3089\u3044\u7d4c\u3064\u306e\u304b\u3082\u3001\u7d4c\u305f\u306a\u3044\u304b\u3082\u3002 \u30ac\u30c3\u30c4\u30ea\u3068\u4f7f\u7528\u3057\u3066\u304d\u305f\u306e\u3067\u3059\u304c\u3001\u4e3b\u306bweb\u30b2\u30fc\u30e0\u4f5c\u6210\u3067\u306e\u4f7f\u7528\u3067\u3057\u305f\u3002 \u4eca\u56de\u3001\u6240\u8b02\u4e00\u822c\u7684\u306a\u300cWeb\u30b5\u30fc\u30d3\u30b9\uff08Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff09\u300d\u3092\u4f5c\u6210 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[177,176,47,120,119,44,45,111,178,64,78,114,51,118],"class_list":{"0":"post-9130","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-javascript","7":"tag-css3","8":"tag-html5","9":"tag-javascript-2","10":"tag-sass","11":"tag-scss","12":"tag-web","14":"tag-wordpress-2","15":"tag-178","16":"tag-64","17":"tag-78","18":"tag-114","19":"tag-51","20":"tag-118"},"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/9130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9130"}],"version-history":[{"count":14,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/9130\/revisions"}],"predecessor-version":[{"id":9147,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/9130\/revisions\/9147"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}