{"id":287234,"date":"2018-08-16T13:32:20","date_gmt":"2018-08-16T09:32:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287234"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287234","title":{"rendered":"\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e GitHub, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Vue"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420351\/\" class=\"post__text post__text-html js-mediator-article\">\n<p>\u0414\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u0443\u0436\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c GitHub \u043d\u0430 <a href=\"https:\/\/habr.com\/post\/419559\/\">React<\/a>, <a href=\"https:\/\/habr.com\/post\/419653\/\">Svelte<\/a>, <a href=\"https:\/\/habr.com\/post\/419933\/\">Angular<\/a>, \u0438\u043b\u0438 <a href=\"https:\/\/habr.com\/post\/419893\/\">\u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u043d\u0438\u0445<\/a>. \u041d\u0443 \u0438 \u043a\u0430\u043a \u0436\u0435 \u0442\u0443\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 Vue? \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hg\/zq\/sd\/hgzqsdxqijgmwiiuoljoxuhosza.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Vue, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u044b \u043d\u0430 Cypress \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u043c Vue CLI 3.<\/p>\n<p>  <\/p>\n<p><em>\u0412 \u043f\u043e\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u0433\u0438\u0444\u043a\u0438<\/em><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"podgotovka\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Vue CLI \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">npm i -g @vue\/cli<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vue create vue-github-search<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u043c \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0432\u044b\u0431\u0440\u0430\u043b Manual mode \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/60\/un\/fa\/60unfaijnhdl9eq46irkjyesiki.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h4 id=\"dopolnitelnye-moduli\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/h4>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0438\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/stylus-lang.com\/\">Stylus<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f stylus \u0438 stylus-loader. \u0415\u0449\u0451 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/axios\/axios\">Axios<\/a> \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u0442\u044c \u0438 <a href=\"https:\/\/lodash.com\/docs\/4.17.10\">Lodash<\/a>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e debounce.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">cd vue-github-search npm i stylus stylus-loader axios lodash<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"proveryaem\">\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/h4>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"> npm run serve<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<p>  <\/p>\n<h2 id=\"store\">Store<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c vuex store, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0425\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e-\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e: \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0444\u043b\u0430\u0433 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<br \/>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c <code>store.js<\/code> \u0438 \u043e\u043f\u0438\u0448\u0435\u043c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0443\u0442\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">... const SET_SEARCH_QUERY = 'SET_SEARCH_QUERY'; const SET_LOADING = 'SET_LOADING'; const SET_USER = 'SET_USER'; const RESET_USER = 'RESET_USER';  export default new Vuex.Store({   state: {     searchQuery: '',     loading: false,     user: null   },   mutations: {     [SET_SEARCH_QUERY]: (state, searchQuery) =&gt; state.searchQuery = searchQuery,     [SET_LOADING]: (state, loading) =&gt; state.loading = loading,     [SET_USER]: (state, user) =&gt; state.user = user,     [RESET_USER]: state =&gt; state.user = null   } });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c action&#8217;\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 GitHub API \u0438 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u043c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438). \u0412 \u0438\u0442\u043e\u0433\u0435 \u043d\u0430\u0448 store \u043f\u0440\u0438\u043c\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<p><strong>store.js<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import Vue from 'vue'; import Vuex from 'vuex'; import axios from 'axios';  Vue.use(Vuex);  const SET_SEARCH_QUERY = 'SET_SEARCH_QUERY'; const SET_LOADING = 'SET_LOADING'; const SET_USER = 'SET_USER'; const RESET_USER = 'RESET_USER';  export default new Vuex.Store({   state: {     searchQuery: '',     loading: false,     user: null   },   mutations: {     [SET_SEARCH_QUERY]: (state, searchQuery) =&gt; state.searchQuery = searchQuery,     [SET_LOADING]: (state, loading) =&gt; state.loading = loading,     [SET_USER]: (state, user) =&gt; state.user = user,     [RESET_USER]: state =&gt; state.user = null   },   actions: {     setSearchQuery({commit}, searchQuery) {       commit(SET_SEARCH_QUERY, searchQuery);     },     async search({commit, state}) {       commit(SET_LOADING, true);       try {         const {data} = await axios.get(`https:\/\/api.github.com\/users\/${state.searchQuery}`);         commit(SET_USER, data);       } catch (e) {         commit(RESET_USER);       }       commit(SET_LOADING, false);     }   } });<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"stroka-poiska\">\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>Search.vue<\/code> \u0432 \u043f\u0430\u043f\u043a\u0435 <code>components<\/code>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c computed-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u043e store. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0441 debounce.<\/p>\n<p>  <\/p>\n<p><strong>Search.vue<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;template&gt;   &lt;input v-model=&quot;query&quot; @input=&quot;debouncedSearch&quot; placeholder=&quot;Enter username&quot; \/&gt; &lt;\/template&gt;  &lt;script&gt; import {mapActions, mapState} from 'vuex'; import debounce from 'lodash\/debounce';  export default {   name: 'search',   computed: {     ...mapState(['searchQuery']),     query: {       get() {         return this.searchQuery;       },       set(val) {         return this.setSearchQuery(val);       }     }   },   methods: {     ...mapActions(['setSearchQuery', 'search']),     debouncedSearch: debounce(function () {       this.search();     }, 500)   } }; &lt;\/script&gt;  &lt;style lang=&quot;stylus&quot; scoped&gt; input   width 100%   font-size 16px   text-align center &lt;\/style&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043d\u0430\u0448\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>App.vue<\/code> \u0438 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u043c \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><strong>App.vue<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;template&gt;   &lt;div id=&quot;app&quot;&gt;     &lt;Search \/&gt;   &lt;\/div&gt; &lt;\/template&gt;  &lt;script&gt; import Search from '.\/components\/Search';  export default {   name: 'app',   components: {     Search   } }; &lt;\/script&gt;  &lt;style lang=&quot;stylus&quot;&gt; #app   font-family 'Avenir', Helvetica, Arial, sans-serif   font-smoothing antialiased   margin 10px &lt;\/style&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0443\u0431\u0435\u0434\u0438\u0432\u0448\u0438\u0441\u044c \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e vue-devtools:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ne\/bq\/km\/nebqkmhxavxunt0b8xwq8r2iyzu.gif\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0430 \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f! \u041c\u044b \u0432\u0432\u043e\u0434\u0438\u043c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 store.<\/p>\n<p>  <\/p>\n<h2 id=\"profil-polzovatelya\">\u041f\u0440\u043e\u0444\u0438\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <code>User.vue<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0434\u043b\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">User.vue<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;template&gt;   &lt;div class=&quot;github-card&quot;&gt;     &lt;transition name=&quot;fade&quot; mode=&quot;out-in&quot;&gt;       &lt;div v-if=&quot;loading&quot; key=&quot;loading&quot;&gt;         Loading       &lt;\/div&gt;       &lt;div v-else-if=&quot;user&quot; key=&quot;user&quot;&gt;         &lt;div class=&quot;background&quot; :style=&quot;{backgroundImage: `url(${user.avatar_url})`}&quot; \/&gt;         &lt;div class=&quot;content&quot;&gt;           &lt;a class=&quot;avatar&quot; :href=&quot;`https:\/\/github.com\/${user.login}`&quot; target=&quot;_blank&quot;&gt;             &lt;img :src=&quot;user.avatar_url&quot; :alt=&quot;user.login&quot; \/&gt;           &lt;\/a&gt;           &lt;h1&gt;{{user.name || user.login}}&lt;\/h1&gt;           &lt;ul class=&quot;status&quot;&gt;             &lt;li&gt;               &lt;a :href=&quot;`https:\/\/github.com\/${user.login}?tab=repositories`&quot; target=&quot;_blank&quot;&gt;                 &lt;strong&gt;{{user.public_repos}}&lt;\/strong&gt;                 &lt;span&gt;Repos&lt;\/span&gt;               &lt;\/a&gt;             &lt;\/li&gt;             &lt;li&gt;               &lt;a :href=&quot;`https:\/\/gist.github.com\/${user.login}`&quot; target=&quot;_blank&quot;&gt;                 &lt;strong&gt;{{user.public_gists}}&lt;\/strong&gt;                 &lt;span&gt;Gists&lt;\/span&gt;               &lt;\/a&gt;             &lt;\/li&gt;             &lt;li&gt;               &lt;a :href=&quot;`https:\/\/github.com\/${user.login}\/followers`&quot; target=&quot;_blank&quot;&gt;                 &lt;strong&gt;{{user.followers}}&lt;\/strong&gt;                 &lt;span&gt;Followers&lt;\/span&gt;               &lt;\/a&gt;             &lt;\/li&gt;           &lt;\/ul&gt;         &lt;\/div&gt;       &lt;\/div&gt;       &lt;div v-else key=&quot;not-found&quot;&gt;         User not found       &lt;\/div&gt;     &lt;\/transition&gt;   &lt;\/div&gt; &lt;\/template&gt;  &lt;script&gt; import {mapState} from 'vuex';  export default {   name: 'User',   computed: mapState(['loading', 'user']) }; &lt;\/script&gt;  &lt;style lang=&quot;stylus&quot; scoped&gt; .github-card   margin-top 50px   padding 20px   text-align center   background #fff   color #000   position relative   h1     margin 16px 0 20px     line-height 1     font-size 24px     font-weight 500   .background     filter blur(10px) opacity(50%)     z-index 1     position absolute     top 0     left 0     right 0     bottom 0     background-size cover     background-position center     background-color #fff   .content     position relative     z-index 2     .avatar       display inline-block       overflow hidden       background #fff       border-radius 100%       text-decoration none       img         display block         width 80px         height 80px     .status       background white     ul       text-transform uppercase       font-size 12px       color gray       list-style-type none       margin 0       padding 0       border-top 1px solid lightgray       border-bottom 1px solid lightgray       zoom 1       &amp;:after         display block         content ''         clear both     li       width 33%       float left       padding 8px 0       box-shadow 1px 0 0 #eee       &amp;:last-of-type         box-shadow none     strong       display block       color #292f33       font-size 16px       line-height 1.6     a       color #707070       text-decoration none       &amp;:hover         color #4183c4  .fade-enter-active, .fade-leave-active   transition opacity .5s .fade-enter, .fade-leave-to   opacity 0 &lt;\/style&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 <code>App.vue<\/code> \u0438 \u043d\u0430\u0441\u043b\u0430\u0434\u0438\u043c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">App.vue<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;template&gt;   &lt;div id=&quot;app&quot;&gt;     &lt;Search \/&gt;     &lt;User \/&gt;   &lt;\/div&gt; &lt;\/template&gt;  &lt;script&gt; import Search from '.\/components\/Search'; import User from '.\/components\/User';  export default {   name: 'app',   components: {     User,     Search   } }; &lt;\/script&gt;  &lt;style lang=&quot;stylus&quot;&gt; #app   font-family 'Avenir', Helvetica, Arial, sans-serif   font-smoothing antialiased   margin 10px &lt;\/style&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dm\/qf\/he\/dmqfheniepjgrzdnkmzfrestim4.gif\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"testy\">\u0422\u0435\u0441\u0442\u044b<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><strong>tests\/e2e\/specs\/test.js<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">describe('Github User Search', () =&gt; {   it('has input for username', () =&gt; {     cy.visit('\/');     cy.get('input');   });   it('has &quot;User not found&quot; caption', () =&gt; {     cy.visit('\/');     cy.contains('User not found');   });   it(&quot;finds Linus Torvalds' GitHub page&quot;, () =&gt; {     cy.visit('\/');     cy.get('input').type('torvalds');     cy.contains('Linus Torvalds');     cy.get('img');     cy.contains('span', 'Repos');     cy.contains('span', 'Gists');     cy.contains('span', 'Followers');   });   it(&quot;doesn't find nonexistent page&quot;, () =&gt; {     cy.visit('\/');     cy.get('input').type('_some_random_name_6m92msz23_2');     cy.contains('User not found');   }); });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0442\u0435\u0441\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">npm run test:e2e<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Run all specs \u0438 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_a\/m-\/qj\/_am-qj3gnvg0sfscigbszdwyxj8.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"sborka\">\u0421\u0431\u043e\u0440\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>Vue CLI 3 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, modern mode. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 2 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432: \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0444\u0438\u0447\u0438 JavaScript, \u0438 \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u043f\u043e\u043b\u0438\u0444\u0438\u043b\u0430\u043c\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u044b\u0445. \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0434\u0435\u043f\u043b\u043e\u0435\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>&lt;script type=&quot;module&quot;&gt;<\/code>, \u043e\u043d \u0441\u0430\u043c \u043f\u043e\u0434\u0442\u044f\u043d\u0435\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443. \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442a\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/philipwalton.com\/articles\/deploying-es2015-code-in-production-today\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 <code>package.json<\/code> \u0444\u043b\u0430\u0433 modern \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code>&quot;build&quot;: &quot;vue-cli-service build --modern&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">npm run build<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code>8.0K    .\/app-legacy.cb7436d4.js 8.0K    .\/app.b16ff4f7.js 116K    .\/chunk-vendors-legacy.1f6dfb2a.js  96K    .\/chunk-vendors.a98036c9.js<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0431\u043e\u0440\u043a\u0438. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0430 \u043d\u0430 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0438\u0447\u0430 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"kod\">\u041a\u043e\u0434<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/VitalyEmelyanov\/vue-github-search\"><strong>GitHub<\/strong><\/a><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/420351\/\"> https:\/\/habr.com\/post\/420351\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420351\/\" class=\"post__text post__text-html js-mediator-article\">\n<p>\u0414\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u0443\u0436\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c GitHub \u043d\u0430 <a href=\"https:\/\/habr.com\/post\/419559\/\">React<\/a>, <a href=\"https:\/\/habr.com\/post\/419653\/\">Svelte<\/a>, <a href=\"https:\/\/habr.com\/post\/419933\/\">Angular<\/a>, \u0438\u043b\u0438 <a href=\"https:\/\/habr.com\/post\/419893\/\">\u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u043d\u0438\u0445<\/a>. \u041d\u0443 \u0438 \u043a\u0430\u043a \u0436\u0435 \u0442\u0443\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 Vue? \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hg\/zq\/sd\/hgzqsdxqijgmwiiuoljoxuhosza.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Vue, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u044b \u043d\u0430 Cypress \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u043c Vue CLI 3.<\/p>\n<p>  <\/p>\n<p><em>\u0412 \u043f\u043e\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u0433\u0438\u0444\u043a\u0438<\/em><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-287234","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=287234"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287234\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}