{"id":417382,"date":"2024-06-30T01:32:00","date_gmt":"2024-06-30T01:32:00","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=417382"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-30T01:32:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=417382","title":{"rendered":"<span>\u0415\u0434\u0438\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u043e\u043a\u043e\u043d \u043d\u0430 vue-cli \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 vuex \u0438 vue-router<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u043e vue \u044f \u0432\u0438\u0434\u0435\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u043e\u043a\u043e\u043d \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u043c\u0438 \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438. \u0418 \u0432\u043e\u0442, \u0432 \u043d\u043e\u0432\u043e\u043c, \u043d\u0430\u0447\u0430\u0442\u043e\u043c \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h3>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f<\/h3>\n<p>\u0412\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d query \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2018dialog\u2019. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 dialog.<\/p>\n<p>\u0421\u0430\u043c\u043e \u043e\u043a\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u2018Dialog-control-panel\u2019 \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u201cDialog-content\u201d \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f vue \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>\u201cDialog-left-btn\u201d \u0438 \u201cDialog-right-btn\u201d \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/95f\/6cf\/373\/95f6cf3738336a6ee14ff20ea7f46c88.png\" width=\"1107\" height=\"571\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/95f\/6cf\/373\/95f6cf3738336a6ee14ff20ea7f46c88.png\"\/><figcaption><\/figcaption><\/figure>\n<\/li>\n<\/ol>\n<h3>\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<ol>\n<li>\n<p>\u201cTheDialog.vue\u201d &#8212; \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u201cDialogAbout.vue\u201d \u0438 \u201cDialogContacts.vue\u201d &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430<\/p>\n<\/li>\n<\/ol>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8e6\/756\/ad3\/8e6756ad382198ab9198bce2dc780fa5.png\" width=\"235\" height=\"174\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8e6\/756\/ad3\/8e6756ad382198ab9198bce2dc780fa5.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0432 vuex<\/h3>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u201cstore\u201d \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u201cdialog\u201d, \u0432 \u043d\u0435\u0439 \u0443\u0436\u0435 \u043d\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f 3 \u0444\u0430\u0439\u043b\u0430 \u201cstate.js\u201d, \u201cmutations.js\u201d \u0438 \u201cindex.js\u201d.<\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0444\u0430\u0439\u043b \u201cstate.js\u201d \u043d\u0443\u0436\u0435\u043d \u043d\u0430\u043c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430, \u0432 \u043d\u0435\u043c \u044f \u043f\u0440\u043e\u043f\u0438\u0448\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 active \u0438 to.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 active \u0441\u0442\u043e\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u201ctrue\u201d, \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435.<\/p>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e to \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u0438\u043b\u0438 \u0436\u0435 \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<pre><code class=\"javascript\">export default function () {   return {     leftBtn: {       active: false,       to: \"\",     },     rightBtn: {       active: false,       to: \"\",     },     downloadBtn: {       active: false,       to: \"\",     },     backBtn: {       active: false,       to: \"\",     },   }; } <\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b \u201cmutations.js\u201d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043c\u0443\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430.<\/p>\n<pre><code class=\"javascript\">export function changeStatusLeftBtn(state, active = false, to = \"\") {   state.leftBtn = { active, to }; }   export function changeStatusRightBtn(state, active = false, to = \"\") {   state.rightBtn = { active, to }; }  export function changeStatusDownloadBtn(state, active = false, to = \"\") {   state.downloadBtn = { active, to }; }   export function changeStatusBackBtn(state, active = false, to = \"\") {   state.backBtn = { active, to }; } <\/code><\/pre>\n<p>\u201cindex.js\u201d\u00a0 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043e\u0434\u0438\u043d \u043c\u043e\u0434\u0443\u043b\u044c<\/p>\n<pre><code class=\"javascript\">import state from '.\/state' import * as mutations from '.\/mutations'   export default {   state,   mutations, } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c dialog \u0432 store.<\/p>\n<pre><code class=\"javascript\">import dialog from \".\/dialog\";     const Store = createStore({     modules: {       dialog,     },   }); <\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u201cTheDialog.vue\u201d<\/p>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0442\u043a\u0430<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0447\u0430\u0435\u043c \u0441\u0430\u043c\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e, \u0447\u0435\u0442\u044b\u0440\u0435 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430, \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f,\u00a0\u0430 \u0442\u0430\u043a \u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b.<\/p>\n<pre><code class=\"xml\">&lt;template>   &lt;div class=\"dialog-bg\">     &lt;div class=\"dialog-control-panel\">       &lt;div class=\"panel\">         &lt;div class=\"btn\" v-ripple v-if=\"backBtn.active\">           &lt;q-icon name=\"eva-arrow-back-outline\" \/>         &lt;\/div>       &lt;\/div>         &lt;div class=\"panel\">         &lt;div class=\"btn\" v-ripple v-if=\"downloadBtn.active\">           &lt;q-icon name=\"eva-cloud-download-outline\" \/>         &lt;\/div>           &lt;div class=\"btn\" v-ripple>           &lt;q-icon name=\"eva-close-outline\" \/>         &lt;\/div>       &lt;\/div>     &lt;\/div>       &lt;div class=\"btn right\" v-ripple v-if=\"rightBtn.active\">       &lt;q-icon name=\"eva-arrow-ios-forward-outline\" \/>     &lt;\/div>       &lt;div class=\"btn left\" v-ripple v-if=\"leftBtn.active\">       &lt;q-icon name=\"eva-arrow-ios-back-outline\" \/>     &lt;\/div>       &lt;div class=\"dialog-content\">       &lt;component :is=\"requiredModule\" \/>     &lt;\/div>   &lt;\/div> &lt;\/template><\/code><\/pre>\n<h3>\u041b\u043e\u0433\u0438\u043a\u0430<\/h3>\n<pre><code class=\"xml\">&lt;script> import DialogAbout from \"components\/dialog\/DialogAbout\"; import DialogContacts from \"components\/dialog\/DialogContacts\"; import { defineComponent, computed } from \"vue\"; import { useRoute } from \"vue-router\"; import { useStore } from \"vuex\";   export default defineComponent({   name: \"TheDialog\",     setup() {     const $store = useStore();     const $route = useRoute();       const requiredModule = computed(() => {       const dialog = $route.query.dialog;         if (dialog === \"about\") return DialogAbout;       if (dialog === \"contacts\") return DialogContacts;         return false;     });       const backBtn = $store.state.dialog.backBtn;     const downloadBtn = $store.state.dialog.downloadBtn;     const leftBtn = $store.state.dialog.leftBtn;     const rightBtn = $store.state.dialog.rightBtn;       return {       requiredModule,       backBtn,       downloadBtn,       leftBtn,       rightBtn,     };   }, }); &lt;\/script> <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 setup \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 computed \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u0435\u0439<\/h3>\n<pre><code class=\"xml\">&lt;style lang=\"scss\" scoped> .dialog-bg {   width: 100%;   min-height: 100vh;   background-color: rgba(30, 30, 30, 0.9);   position: fixed;   left: 0;   top: 0;   z-index: 10;   padding: 100px 0;     .btn {     width: 80px;     height: 80px;     color: rgba(255, 255, 255, 0.637);     font-size: 1.8rem;     display: flex;     justify-content: center;     align-items: center;     cursor: pointer;     position: relative;     transition: background-color 0.2s;       &amp;:hover {       background-color: rgba(0, 0, 0, 0.2);     }   }     .dialog-control-panel {     width: 100%;     display: flex;     justify-content: space-between;     position: fixed;     top: 0;     left: 0;       .panel {       display: flex;     }   }     .right,   .left {     position: fixed;     height: calc(100vh - 160px);     top: 80px;   }     .right {     right: 0;   }     .left {     left: 0;   }     .dialog-content {     max-width: 732px;     margin: auto;   } } &lt;\/style> <\/code><\/pre>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h3>\n<p>\u0412\u0441\u0435! \u041d\u0430\u0448\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0433\u043e\u0442\u043e\u0432\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/c5d\/f52\/cca\/c5df52cca827b9b30fd6d8dddb5d0127.jpg\" width=\"1280\" height=\"676\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5d\/f52\/cca\/c5df52cca827b9b30fd6d8dddb5d0127.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/de8\/8b1\/356\/de88b1356c2dcb408e7b7748f08ee378.jpg\" width=\"1280\" height=\"678\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/de8\/8b1\/356\/de88b1356c2dcb408e7b7748f08ee378.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/593407\/\"> https:\/\/habr.com\/ru\/articles\/593407\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u043e vue \u044f \u0432\u0438\u0434\u0435\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u043e\u043a\u043e\u043d \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u043c\u0438 \u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438. \u0418 \u0432\u043e\u0442, \u0432 \u043d\u043e\u0432\u043e\u043c, \u043d\u0430\u0447\u0430\u0442\u043e\u043c \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h3>\u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f<\/h3>\n<p>\u0412\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d query \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2018dialog\u2019. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 dialog.<\/p>\n<p>\u0421\u0430\u043c\u043e \u043e\u043a\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u2018Dialog-control-panel\u2019 \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u201cDialog-content\u201d \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f vue \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>\u201cDialog-left-btn\u201d \u0438 \u201cDialog-right-btn\u201d \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<\/li>\n<\/ol>\n<h3>\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:<\/p>\n<ol>\n<li>\n<p>\u201cTheDialog.vue\u201d &#8212; \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u201cDialogAbout.vue\u201d \u0438 \u201cDialogContacts.vue\u201d &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430<\/p>\n<\/li>\n<\/ol>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0432 vuex<\/h3>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u201cstore\u201d \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u201cdialog\u201d, \u0432 \u043d\u0435\u0439 \u0443\u0436\u0435 \u043d\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f 3 \u0444\u0430\u0439\u043b\u0430 \u201cstate.js\u201d, \u201cmutations.js\u201d \u0438 \u201cindex.js\u201d.<\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0444\u0430\u0439\u043b \u201cstate.js\u201d \u043d\u0443\u0436\u0435\u043d \u043d\u0430\u043c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430, \u0432 \u043d\u0435\u043c \u044f \u043f\u0440\u043e\u043f\u0438\u0448\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 active \u0438 to.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 active \u0441\u0442\u043e\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u201ctrue\u201d, \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435.<\/p>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e to \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u0438\u043b\u0438 \u0436\u0435 \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<pre><code class=\"javascript\">export default function () {   return {     leftBtn: {       active: false,       to: \"\",     },     rightBtn: {       active: false,       to: \"\",     },     downloadBtn: {       active: false,       to: \"\",     },     backBtn: {       active: false,       to: \"\",     },   }; } <\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b \u201cmutations.js\u201d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043c\u0443\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430.<\/p>\n<pre><code class=\"javascript\">export function changeStatusLeftBtn(state, active = false, to = \"\") {   state.leftBtn = { active, to }; }   export function changeStatusRightBtn(state, active = false, to = \"\") {   state.rightBtn = { active, to }; }  export function changeStatusDownloadBtn(state, active = false, to = \"\") {   state.downloadBtn = { active, to }; }   export function changeStatusBackBtn(state, active = false, to = \"\") {   state.backBtn = { active, to }; } <\/code><\/pre>\n<p>\u201cindex.js\u201d\u00a0 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043e\u0434\u0438\u043d \u043c\u043e\u0434\u0443\u043b\u044c<\/p>\n<pre><code class=\"javascript\">import state from '.\/state' import * as mutations from '.\/mutations'   export default {   state,   mutations, } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c dialog \u0432 store.<\/p>\n<pre><code class=\"javascript\">import dialog from \".\/dialog\";     const Store = createStore({     modules: {       dialog,     },   }); <\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u201cTheDialog.vue\u201d<\/p>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0442\u043a\u0430<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0447\u0430\u0435\u043c \u0441\u0430\u043c\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e, \u0447\u0435\u0442\u044b\u0440\u0435 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0430, \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f,\u00a0\u0430 \u0442\u0430\u043a \u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b.<\/p>\n<pre><code class=\"xml\">&lt;template>   &lt;div class=\"dialog-bg\">     &lt;div class=\"dialog-control-panel\">       &lt;div class=\"panel\">         &lt;div class=\"btn\" v-ripple v-if=\"backBtn.active\">           &lt;q-icon name=\"eva-arrow-back-outline\" \/>         &lt;\/div>       &lt;\/div>         &lt;div class=\"panel\">         &lt;div class=\"btn\" v-ripple v-if=\"downloadBtn.active\">           &lt;q-icon name=\"eva-cloud-download-outline\" \/>         &lt;\/div>           &lt;div class=\"btn\" v-ripple>           &lt;q-icon name=\"eva-close-outline\" \/>         &lt;\/div>       &lt;\/div>     &lt;\/div>       &lt;div class=\"btn right\" v-ripple v-if=\"rightBtn.active\">       &lt;q-icon name=\"eva-arrow-ios-forward-outline\" \/>     &lt;\/div>       &lt;div class=\"btn left\" v-ripple v-if=\"leftBtn.active\">       &lt;q-icon name=\"eva-arrow-ios-back-outline\" \/>     &lt;\/div>       &lt;div class=\"dialog-content\">       &lt;component :is=\"requiredModule\" \/>     &lt;\/div>   &lt;\/div> &lt;\/template><\/code><\/pre>\n<h3>\u041b\u043e\u0433\u0438\u043a\u0430<\/h3>\n<pre><code class=\"xml\">&lt;script> import DialogAbout from \"components\/dialog\/DialogAbout\"; import DialogContacts from \"components\/dialog\/DialogContacts\"; import { defineComponent, computed } from \"vue\"; import { useRoute } from \"vue-router\"; import { useStore } from \"vuex\";   export default defineComponent({   name: \"TheDialog\",     setup() {     const $store = useStore();     const $route = useRoute();       const requiredModule = computed(() => {       const dialog = $route.query.dialog;         if (dialog === \"about\") return DialogAbout;       if (dialog === \"contacts\") return DialogContacts;         return false;     });       const backBtn = $store.state.dialog.backBtn;     const downloadBtn = $store.state.dialog.downloadBtn;     const leftBtn = $store.state.dialog.leftBtn;     const rightBtn = $store.state.dialog.rightBtn;       return {       requiredModule,       backBtn,       downloadBtn,       leftBtn,       rightBtn,     };   }, }); &lt;\/script> <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 setup \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 computed \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u0435\u0439<\/h3>\n<pre><code class=\"xml\">&lt;style lang=\"scss\" scoped> .dialog-bg {   width: 100%;   min-height: 100vh;   background-color: rgba(30, 30, 30, 0.9);   position: fixed;   left: 0;   top: 0;   z-index: 10;   padding: 100px 0;     .btn {     width: 80px;     height: 80px;     color: rgba(255, 255, 255, 0.637);     font-size: 1.8rem;     display: flex;     justify-content: center;     align-items: center;     cursor: pointer;     position: relative;     transition: background-color 0.2s;       &amp;:hover {       background-color: rgba(0, 0, 0, 0.2);     }   }     .dialog-control-panel {     width: 100%;     display: flex;     justify-content: space-between;     position: fixed;     top: 0;     left: 0;       .panel {       display: flex;     }   }     .right,   .left {     position: fixed;     height: calc(100vh - 160px);     top: 80px;   }     .right {     right: 0;   }     .left {     left: 0;   }     .dialog-content {     max-width: 732px;     margin: auto;   } } &lt;\/style> <\/code><\/pre>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h3>\n<p>\u0412\u0441\u0435! \u041d\u0430\u0448\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0433\u043e\u0442\u043e\u0432\u043e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/593407\/\"> https:\/\/habr.com\/ru\/articles\/593407\/<\/a><br \/><\/br><\/br><\/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-417382","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/417382","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=417382"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/417382\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=417382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=417382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=417382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}