{"id":307265,"date":"2020-07-21T15:00:38","date_gmt":"2020-07-21T15:00:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307265"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307265","title":{"rendered":"Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 5: \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/511600\/\">\u0421\u0435\u0433\u043e\u0434\u043d\u044f, \u0432 \u043f\u044f\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043a\u0443\u0440\u0441\u0430 \u043f\u043e Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/511600\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oh\/dl\/qa\/ohdlqapwejgoqdsl4nt7y4amsrc.jpeg\"><\/a><\/p>\n<p>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/509700\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 1: \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Vue<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/509702\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 2: \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/510628\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 3: \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/510628\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 4: \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043f\u0438\u0441\u043a\u043e\u0432<\/a><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0426\u0435\u043b\u044c \u0443\u0440\u043e\u043a\u0430<\/font><\/h2>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u0446\u0435\u043b\u044c \u0443\u0440\u043e\u043a\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0435 \u0442\u043e\u0432\u0430\u0440\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u043a\u043d\u043e\u043f\u043a\u0430, \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0446\u0435\u043b\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043c\u044b\u0448\u0438 \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0442\u043e\u0432\u0430\u0440\u0430 \u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u0430.<\/p>\n<h2><font color=\"#3AC1EF\">\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430<\/font><\/h2>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>index.html<\/code> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"html\">&lt;div id=&quot;app&quot;&gt; \u00a0\u00a0&lt;div class=&quot;product&quot;&gt; \u00a0\u00a0\u00a0\u00a0&lt;div class=&quot;product-image&quot;&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;img :src=&quot;image&quot; \/&gt; \u00a0\u00a0\u00a0\u00a0&lt;\/div&gt;  \u00a0\u00a0\u00a0\u00a0&lt;div class=&quot;product-info&quot;&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;h1&gt;{{ product }}&lt;\/h1&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;p v-if=&quot;inStock&quot;&gt;In stock&lt;\/p&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;p v-else&gt;Out of Stock&lt;\/p&gt;  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;ul&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;li v-for=&quot;detail in details&quot;&gt;{{ detail }}&lt;\/li&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\/ul&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;div v-for=&quot;variant in variants&quot; :key=&quot;variant.variantId&quot;&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;p&gt;{{ variant.variantColor }}&lt;\/p&gt; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\/div&gt;  \u00a0\u00a0\u00a0\u00a0&lt;\/div&gt; \u00a0\u00a0&lt;\/div&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>main.js<\/code>:<\/p>\n<pre><code class=\"javascript\">var app = new Vue({ \u00a0\u00a0\u00a0\u00a0el: '#app', \u00a0\u00a0\u00a0\u00a0data: { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0product: &quot;Socks&quot;, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0image: &quot;.\/assets\/vmSocks-green.jpg&quot;, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0inStock: true, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0details: ['80% cotton', '20% polyester', 'Gender-neutral'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0variants: [ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0variantId: 2234, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0variantColor: &quot;green&quot; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0variantId: 2235, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0variantColor: &quot;blue&quot; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0] \u00a0\u00a0\u00a0\u00a0} }) <\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0417\u0430\u0434\u0430\u0447\u0430<\/font><\/h2>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043d\u0430 \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u043d\u0435\u0439. \u041f\u043e \u0449\u0435\u043b\u0447\u043a\u0443 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435.<\/p>\n<h2><font color=\"#3AC1EF\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u043c, \u0432 <code>main.js<\/code>, \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 <code>data<\/code>, \u043d\u043e\u0432\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435:<\/p>\n<pre><code class=\"javascript\">cart: 0 <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0432 <code>index.html<\/code>, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>&lt;div&gt;<\/code>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0440\u0437\u0438\u043d\u0443. \u0412 \u044d\u0442\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0442\u0435\u0433 <code>&lt;p&gt;<\/code>, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0447\u0438\u0441\u043b\u043e, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 <code>cart<\/code>:<\/p>\n<pre><code class=\"html\">&lt;div class=&quot;cart&quot;&gt; \u00a0\u00a0&lt;p&gt;Cart({{ cart }})&lt;\/p&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043e\u0434\u0435 <code>index.html<\/code> \u043a\u043d\u043e\u043f\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u043e\u0432\u0430\u0440 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0443:<\/p>\n<pre><code class=\"html\">&lt;button v-on:click=&quot;cart += 1&quot;&gt;Add to cart&lt;\/button&gt; <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u0432 <code>cart<\/code>, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 <code>v-on<\/code>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/723\/864\/75b\/72386475b51117c1a9ac7d8c48b68d72.png\"><\/div>\n<p>  <i><font color=\"#999999\">\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043a\u043e\u0440\u0437\u0438\u043d\u043e\u0439 \u0438 \u0441 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0443\u00a0<\/font><\/i><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0436\u0430\u0442\u044c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u0441\u044f \u043d\u0430 1.<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0434\u0435\u0441\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>v-on<\/code> \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 Vue \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441 \u043a\u043d\u043e\u043f\u043a\u043e\u0439. \u041f\u043e\u0442\u043e\u043c \u0438\u0434\u0451\u0442 \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e, \u043a\u0430\u043a\u043e\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u2014 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>click<\/code>. \u0412 \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u0445 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 1 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u043c\u0443\u0441\u044f \u0432 <code>cart<\/code>. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0449\u0435\u043b\u0447\u043a\u0435 \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435.<\/p>\n<p>  \u042d\u0442\u043e \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u043e \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>cart += 1<\/code>, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u043b \u0431\u044b \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435\u0441\u044f \u0432 <code>cart<\/code>. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<pre><code class=\"html\">&lt;button v-on:click=&quot;addToCart&quot;&gt;Add to cart&lt;\/button&gt; <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0437\u0434\u0435\u0441\u044c <code>addToCart<\/code> \u2014 \u044d\u0442\u043e \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f <code>click<\/code>. \u041d\u043e \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434 \u043c\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441, \u043e\u0441\u043d\u0430\u0441\u0442\u0438\u0432 \u0438\u043c \u043d\u0430\u0448 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Vue.<\/p>\n<p>  \u0422\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u043e\u043f\u0446\u0438\u044f\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Vue, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043d\u043e\u0441\u044f\u0449\u0435\u0435 \u0438\u043c\u044f <code>methods<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u2014 <code>addToCart<\/code>:<\/p>\n<pre><code class=\"javascript\">methods: { \u00a0\u00a0addToCart() { \u00a0\u00a0\u00a0\u00a0this.cart += 1 \u00a0\u00a0} } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0449\u0451\u043b\u043a\u0430\u0435\u043c \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>addToCart<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>cart<\/code>, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0435\u0435\u0441\u044f \u0432 \u0442\u0435\u0433\u0435 <code>&lt;p&gt;<\/code>.<\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>  \u041a\u043d\u043e\u043f\u043a\u0430 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f <code>click<\/code> \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0435 <code>v-on<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>addToCart<\/code>. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 <code>methods<\/code> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Vue. \u0412 \u0442\u0435\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f 1 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <code>this.cart<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a <code>this<\/code> \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u043e \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Vue, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 1 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <code>cart<\/code>. \u0410 <code>this.cart<\/code> \u2014 \u044d\u0442\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>cart<\/code>, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 <code>data<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u043e\u043f\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0431\u044b \u0432 \u0442\u0435\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <code>cart += 1<\/code>, \u0442\u043e \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u0431\u044b \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 <code>cart is not defined<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <code>this.cart<\/code> \u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a <code>cart<\/code> \u0438\u0437 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Vue, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>this<\/code>.<\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u0434\u0430\u0451\u0442\u0435\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435, \u043d\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u043e\u0432\u0430\u0440\u0430 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0443 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c. \u041c\u043e\u0436\u0435\u0442, \u043c\u044b \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435 \u0442\u0430\u043a? \u042d\u0442\u043e \u2014 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e\u0437\u0436\u0435, \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0440\u043e\u043a\u043e\u0432.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0437\u0443\u0447\u0438\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u043e Vue, \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u2014 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>variants<\/code> \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>data<\/code>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u0443\u0434\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>variantImage<\/code>, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435 \u043f\u0443\u0442\u044c \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0442\u043e\u0432\u0430\u0440\u0430. \u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0434\u0435\u043b \u0444\u0430\u0439\u043b\u0430 <code>main.js<\/code> \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<pre><code class=\"javascript\">variants: [ \u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0variantId: 2234, \u00a0\u00a0\u00a0\u00a0variantColor: &quot;green&quot;, \u00a0\u00a0\u00a0\u00a0variantImage: &quot;.\/assets\/vmSocks-green.jpg&quot;\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0}, \u00a0\u00a0{ \u00a0\u00a0\u00a0\u00a0variantId: 2235, \u00a0\u00a0\u00a0\u00a0variantColor: &quot;blue&quot;, \u00a0\u00a0\u00a0\u00a0variantImage: &quot;.\/assets\/vmSocks-blue.jpg&quot;\u00a0 \u00a0\u00a0} ], <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443 \u0442\u043e\u0432\u0430\u0440\u0430, \u0437\u0435\u043b\u0451\u043d\u044b\u043c \u0438 \u0441\u0438\u043d\u0438\u043c \u043d\u043e\u0441\u043a\u0430\u043c, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h2><font color=\"#3AC1EF\">\u0417\u0430\u0434\u0430\u0447\u0430<\/font><\/h2>\n<p>  \u041d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b, \u043f\u043e \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043c\u044b\u0448\u0438 \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043d\u043e\u0441\u043a\u043e\u0432, \u0432 \u043f\u043e\u043b\u0435, \u0433\u0434\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u0430, \u0432\u044b\u0432\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>variantImage<\/code> \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0446\u0432\u0435\u0442\u0430.<\/p>\n<h2><font color=\"#3AC1EF\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0422\u0443\u0442 \u043d\u0430\u043c \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>v-on<\/code>. \u041d\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0435\u0451 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a <code>@<\/code>. \u0410 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>mouseover<\/code>.<\/p>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 <code>index.html<\/code>:<\/p>\n<pre><code class=\"html\">&lt;div v-for=&quot;variant in variants&quot; :key=&quot;variant.variantId&quot;&gt; \u00a0\u00a0&lt;p @mouseover=&quot;updateProduct(variant.variantImage)&quot;&gt; \u00a0\u00a0\u00a0\u00a0{{ variant.variantColor }} \u00a0\u00a0&lt;\/p&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043c\u0435\u0442\u043e\u0434\u0443 <code>updateProduct<\/code>, \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, <code>variant.variantImage<\/code>.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 <code>main.js<\/code>:<\/p>\n<pre><code class=\"javascript\">updateProduct(variantImage) { \u00a0\u00a0this.image = variantImage } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>cart<\/code>.<\/p>\n<p>  \u041d\u043e \u0442\u0443\u0442 \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435\u0441\u044f \u0432 <code>image<\/code>. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0432 <code>image<\/code> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 <code>variantImage<\/code> \u0442\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0432\u0435\u0434\u0451\u043d \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u044b\u0448\u0438. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>updateProduct<\/code> \u0438\u0437 \u0441\u0430\u043c\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u0432 <code>index.html<\/code>:<\/p>\n<pre><code class=\"html\">&lt;p @mouseover=&quot;updateProduct(variant.variantImage)&quot;&gt; <\/code><\/pre>\n<p>  \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u0435\u0442\u043e\u0434 <code>updateProduct<\/code> \u0433\u043e\u0442\u043e\u0432 \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>variantImage<\/code>.<\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, <code>variant.variantImage<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0435\u043c\u0443 \u0432 \u0432\u0438\u0434\u0435 <code>variantImage<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0433\u043e\u0441\u044f \u0432 <code>this.image<\/code>. \u041c\u044b, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 <code>this.cart<\/code>, \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e <code>this.image<\/code> \u2014 \u044d\u0442\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e <code>image<\/code>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435\u0441\u044f \u0432 <code>image<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0432\u0435\u0434\u0451\u043d \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u044b\u0448\u0438.<\/p>\n<h2><font color=\"#3AC1EF\">\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 ES6<\/font><\/h2>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">updateProduct(variantImage) { \u00a0\u00a0this.image = variantImage } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 ES6. \u0411\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">updateProduct: function(variantImage) { \u00a0\u00a0this.image = variantImage } <\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0443\u043c<\/font><\/h2>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435\u0441\u044f \u0432 <code>cart<\/code>.<\/p>\n<p>  \u2192 <a href=\"https:\/\/codepen.io\/GreggPollack\/pen\/wNVGyJ\">\u0412\u043e\u0442<\/a> \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u2192\u00a0<a href=\"https:\/\/codepen.io\/GreggPollack\/pen\/QYeNQq\">\u0412\u043e\u0442<\/a> \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0442\u043e\u0433\u0438<\/font><\/h2>\n<p>  \u041f\u043e\u0434\u0432\u0435\u0434\u0451\u043c \u0438\u0442\u043e\u0433\u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u043d\u044f\u0442\u0438\u044f:<\/p>\n<ul>\n<li>\u0414\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>v-on<\/code>.<\/li>\n<li>\u0421\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <code>v-on<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a <code>@<\/code>.<\/li>\n<li>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>v-on<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0438\u043f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f:\n<ul>\n<li>click<\/li>\n<li>mouseover<\/li>\n<li>\u043b\u044e\u0431\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 DOM<\/li>\n<\/ul>\n<\/li>\n<li>\u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>v-on<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>v-on<\/code>, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b.<\/li>\n<li>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>this<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u043e \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Vue. \u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435.<\/li>\n<\/ul>\n<p>  <b>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u0443 \u0432\u0430\u0441 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043a \u044d\u0442\u043e\u043c\u0443 \u0443\u0440\u043e\u043a\u0443?<\/b><\/p>\n<p>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/509700\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 1: \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Vue<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/509702\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 2: \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/510628\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 3: \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/510628\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 4: \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043f\u0438\u0441\u043a\u043e\u0432<\/a><\/p>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=perevod&amp;utm_campaign=vuelesson5#order\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/de\/0y\/l-\/de0yl-6ppopvisr_a80b4yuhjj8.png\"><\/a><\/div>\n<p> \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\/ru\/company\/ruvds\/blog\/511600\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/511600\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/511600\/\">\u0421\u0435\u0433\u043e\u0434\u043d\u044f, \u0432 \u043f\u044f\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043a\u0443\u0440\u0441\u0430 \u043f\u043e Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/511600\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oh\/dl\/qa\/ohdlqapwejgoqdsl4nt7y4amsrc.jpeg\"><\/a><\/p>\n<p>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/509700\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 1: \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Vue<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/509702\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 2: \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/510628\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 3: \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/a><br \/>  \u2192 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/510628\/\">Vue.js \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0443\u0440\u043e\u043a 4: \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043f\u0438\u0441\u043a\u043e\u0432<\/a>  <\/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-307265","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307265","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=307265"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307265\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}