{"id":303960,"date":"2020-05-20T21:00:21","date_gmt":"2020-05-20T21:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303960"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303960","title":{"rendered":"Alpine.js \u2014 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e"},"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\/post\/502540\/\">\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/github.com\/alpinejs\/alpine\" rel=\"nofollow\">Alpine.js<\/a>.<br \/>  \u041f\u0435\u0440\u0432\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:<br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/501312\/\">Alpine.js \u2014 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c<\/a><\/p>\n<p>  <\/p>\n<p> \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0441 \u044d\u0442\u0438\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c.<br \/>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0443\u0440\u043e\u043a\u0430 <a href=\"https:\/\/playcode.io\/604095\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1>X-SHOW \u0438 X-CLOAK<\/h1>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div x-data=&quot;{ show: false }&quot;&gt;   &lt;button x-on:click=&quot;show= ! show&quot; x-text=&quot;show ? '\u0421\u043a\u0440\u044b\u0442\u044c' : '\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c' &quot;&gt;   &lt;\/button&gt;   &lt;p x-show=&quot;show&quot; x-cloak&gt;\u041f\u0440\u0438\u0432\u0435\u0442!&lt;\/p&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  <\/p>\n<p> \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0435 \u043d\u043e\u0432\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b. X-show \u0445\u043e\u0442\u044c \u0438 \u043f\u043e\u0445\u043e\u0436\u0430 \u043f\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0441 x-if, \u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0438\u0445 \u043f\u0443\u0442\u0430\u0442\u044c. X-show \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0434\u0440\u0435\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c display \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d, \u043d\u043e \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d. <\/p>\n<p>  <\/p>\n<p>X-cloak \u044d\u0442\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043a\u0430\u043a\u043e\u0439 \u0432 \u043d\u0435\u0439 \u0442\u043e\u043b\u043a? \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u0434 \u0432\u044b\u0448\u0435, \u043d\u0430 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u00ab\u041f\u0440\u0438\u0432\u0435\u0442!\u00bb, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 false \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0435 x-show. \u0422\u0443\u0442 \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 x-cloak, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0442\u0438\u043b\u044c: <\/p>\n<p>  <\/p>\n<pre><code class=\"css\">[x-cloak] {    display: none; } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0440\u044b\u0442 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0438\u0441\u0447\u0435\u0437\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 .transition.<\/p>\n<p>  <\/p>\n<h1>X-SHOW.TRANSITION<\/h1>\n<p>  <\/p>\n<p>\u0423\u043b\u0443\u0447\u0448\u0438\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;div x-data=&quot;{ show: false }&quot;&gt;   &lt;button x-on:click=&quot;show= ! show&quot; x-text=&quot;show ? '\u0421\u043a\u0440\u044b\u0442\u044c': '\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c' &quot;&gt;   &lt;\/button&gt;   &lt;p x-show=&quot;show&quot;&gt; NO TRANSITION&lt;\/p&gt;   &lt;p x-show.transition=&quot;show&quot;&gt;TRANSITION&lt;\/p&gt;   &lt;p x-show.transition.in.duration.1000ms=&quot;show&quot;&gt;TRANSITION IN&lt;\/p&gt;   &lt;p x-show.transition.out.duration.1000ms=&quot;show&quot;&gt;TRANSITION OUT&lt;\/p&gt;   &lt;p x-show.transition.scale.05.duration.1000ms=&quot;show&quot;&gt;TRANSITION Scale&lt;\/p&gt;   &lt;p x-show.transition.opacity.in.duration.1000ms=&quot;show&quot;&gt;TRANSITION Opacity&lt;\/p&gt;   &lt;p x-show.transition.in.duration.1000ms.out.duration.500ms=&quot;show&quot;&gt;TRANSITION IN Duration&lt;\/p&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438 \u0434\u0440\u0443\u0433 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u043c \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e 1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 .in.duration.1000ms <\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e transition (\u0431\u0435\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 opacity \u0438 scale ( scale: 0.95), \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e cubic-bezier(0.4, 0.0, 0.2, 1), 150 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438 75 \u0434\u043b\u044f \u0438\u0441\u0447\u0435\u0437\u043d\u043e\u0432\u0435\u043d\u0438\u044f. \u042d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u043b\u043e\u0437\u0430\u043c\u0435\u0442\u043d\u044b \u0434\u043b\u044f \u0433\u043b\u0430\u0437\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u0443\u0434\u043b\u0438\u043d\u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>.in \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f;<\/li>\n<li>.out \u2014 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0438\u0441\u0447\u0435\u0437\u043d\u043e\u0432\u0435\u043d\u0438\u044f;<\/li>\n<li>.scale \u2014 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430;<\/li>\n<li>.opacity \u2014 \u0434\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438;<\/li>\n<li>.duration \u0437\u0430\u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b x-if \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 x-transition. \u041e\u043d\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0438 \u043d\u0430 x-show. \u0415\u0451 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437. \u0414\u043b\u044f \u043d\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438\u0432\u044b\u0445 \u0435\u0441\u0442\u044c <a href=\"https:\/\/github.com\/alpinejs\/alpine#x-transition\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430 <\/a>.<\/p>\n<p>  <\/p>\n<h1>X-INIT<\/h1>\n<p>  <\/p>\n<p>X-init \u2014 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u041f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 created \u0432\u043e Vue.js. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 x-data. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\"> &lt;div   x-data=&quot;{ posts: [] }&quot;   x-init=&quot;     fetch('https:\/\/jsonplaceholder.typicode.com\/albums\/1\/photos')       .then((response) =&gt; {         return response.json();       })       .then((data) =&gt; {         posts = data       });     &quot; &gt;   &lt;template x-for=&quot;post in posts&quot; :key=&quot;post.id&quot;&gt;     &lt;div class=&quot;post&quot;&gt;       &lt;h1 x-text=&quot;post.title&quot;&gt;&lt;\/h1&gt;       &lt;img :src=&quot;post.thumbnailUrl&quot; :alt=&quot;post.title&quot; \/&gt;     &lt;\/div&gt;   &lt;\/template&gt;   &lt;hr\/&gt; &lt;\/div&gt; <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 x-data \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 posts, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0438\u0447\u0435\u0433\u043e. \u0412 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0435 x-init \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fetch \u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 json-\u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443. \u041f\u043e\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e x-for \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u00ab\u043f\u043e\u0441\u0442\u044b\u00bb \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. <\/p>\n<p>  <\/p>\n<h1>X-REF \u0438 $REFS<\/h1>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0432 \u043b\u044e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0432\u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430. \u0412\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 $ref. \u041f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:  <\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;div x-data=&quot;{ }&quot;&gt;   &lt;input type=&quot;text&quot; x-ref=&quot;myInput&quot;\/&gt;   &lt;button x-on:click=&quot;alert($refs.myInput.value)&quot;&gt;Alert&lt;\/button&gt; &lt;hr \/&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p> \u0422\u0435\u043a\u0441\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 input \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c x-ref=\u00abmyInput\u00bb \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 $refs.myInput.value <\/p>\n<p>  <\/p>\n<p> \u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0448 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0443\u0440\u043e\u043a \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0440\u043e\u043a\u0430 <a href=\"https:\/\/playcode.io\/604095\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<br \/>  \u0412\u0441\u0435\u043c \u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u0434\u043e \u0441\u043a\u043e\u0440\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447!  <\/p>\n<\/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\/post\/502540\/\"> https:\/\/habr.com\/ru\/post\/502540\/<\/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\/post\/502540\/\">\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/github.com\/alpinejs\/alpine\" rel=\"nofollow\">Alpine.js<\/a>.<br \/>  \u041f\u0435\u0440\u0432\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:<br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/501312\/\">Alpine.js \u2014 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c<\/a><\/p>\n<p>  <\/p>\n<p> \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0441 \u044d\u0442\u0438\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c.<br \/>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0443\u0440\u043e\u043a\u0430 <a href=\"https:\/\/playcode.io\/604095\/\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/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-303960","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303960","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=303960"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303960\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}