{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/vue-js/dynamic-v-b-modal/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Today I Learned"}},"markdownRemark":{"id":"b9ad36d9-f71d-5c87-901e-e3b193a1bbfb","excerpt":"0. 서론 리스트 페이지에서 각 항목마다 버튼을 배치하고, 클릭시 항목별로 다른 모달이 팝업되도록 하고싶었다. 1. 적용 방법 처음 사용하던 소스는 다음과 같다.  안에서 같은 의 모달을 여러번 사용했다. 검색 후 다음과 같이 변경했다. 출처 9…","html":"<h2>0. 서론</h2>\n<p>리스트 페이지에서 각 항목마다 버튼을 배치하고, 클릭시 항목별로 다른 모달이 팝업되도록 하고싶었다.</p>\n<h2>1. 적용 방법</h2>\n<p>처음 사용하던 소스는 다음과 같다. <code class=\"language-text\">for loop</code> 안에서 같은 <code class=\"language-text\">id</code>의 모달을 여러번 사용했다.</p>\n<div class=\"gatsby-highlight\" data-language=\"vue\"><pre class=\"language-vue\"><code class=\"language-vue\">&lt;b-tr v-for=&quot;inventory_process in inventory_process_list&quot; :key=&quot;inventory_process.id&quot;&gt;\r\n...\r\n&lt;b-td class=&quot;text-center&quot;&gt;\r\n  &lt;b-button variant=&quot;danger&quot; v-b-modal.modal-block-vcenter&gt;삭제&lt;/b-button&gt;\r\n&lt;/b-td&gt;\r\n&lt;!-- Vertically Centered Block Modal --&gt;\r\n&lt;b-modal id=&quot;modal-block-vcenter&quot; body-class=&quot;p-0&quot; centered hide-footer hide-header&gt;\r\n  &lt;div class=&quot;block block-rounded block-themed block-transparent mb-0&quot;&gt;\r\n    &lt;div class=&quot;block-header bg-primary-dark&quot;&gt;\r\n...\r\n&lt;/b-tr&gt;</code></pre></div>\n<p>검색 후 다음과 같이 변경했다.</p>\n<div class=\"gatsby-highlight\" data-language=\"vue\"><pre class=\"language-vue\"><code class=\"language-vue\">기존 : &lt;b-button variant=&quot;danger&quot; v-b-modal.modal-block-vcenter&gt;삭제&lt;/b-button&gt;\r\n\r\n변경 : &lt;b-button variant=&quot;danger&quot; v-b-modal=&quot;&#39;modal-block-vcenter-&#39; + inventory_process.id&quot;&gt;삭제&lt;/b-button&gt;</code></pre></div>\n<div class=\"gatsby-highlight\" data-language=\"vue\"><pre class=\"language-vue\"><code class=\"language-vue\">기존 : &lt;b-modal id=&quot;modal-block-vcenter&quot; body-class=&quot;p-0&quot; centered hide-footer hide-header&gt;\r\n\r\n변경 : &lt;b-modal :id=&quot;`modal-block-vcenter-`+inventory_process.id&quot; body-class=&quot;p-0&quot; centered hide-footer hide-header&gt;</code></pre></div>\n<p><a href=\"https://stackoverflow.com/questions/47281857/bind-modal-to-corresponding-button-after-a-v-for\">출처</a></p>\n<h2>99. 끝나고 나서</h2>\n<p><code class=\"language-text\">for loop</code> 내부에 모달을 만들지 말고 하나의 모달에 버튼을 누를때마다 데이터를 전달하는 방식으로 하는것이 더 좋았을것같다.</p>","frontmatter":{"title":"v-b-modal 변수와 함께 사용하기","date":"March 24, 2022","description":null},"fields":{"category":null,"slug":"/vue-js/dynamic-v-b-modal/"}},"previous":{"fields":{"slug":"/software-development-plan/user-guide/"},"frontmatter":{"title":"사용자 가이드 만들기"}},"next":{"fields":{"slug":"/vue-js/vue-router-refresh/"},"frontmatter":{"title":"Vue Router 를 사용하여 페이지 새로고침 하기"}}},"pageContext":{"id":"b9ad36d9-f71d-5c87-901e-e3b193a1bbfb","previousPostId":"f16118d8-706d-533c-acae-484d36a5fc54","nextPostId":"657fbc08-d997-5817-9576-fd55c24f22cb"}},
    "staticQueryHashes": ["230163734","2841359383","3496359572"]}