下拉選單內容 Dropdown Menu


下拉選單需要的東西:

  • 按鈕 trigger button
  • 填充內容 dropdown context
    以上是 dropdoen menu template 要製作的 slot

trigger button:

  • isOpen 判斷是否開啟選單
    //trigger btn
    <div class="dropdown-trigger"
         @click.prevent="isOpen = ! isOpen"
    >

    //切換顯示/隱藏內容 toggle context
    <ul v-show="isOpen"
        class="dropdown-menu absolute bg-black mt-2 py-2 rounded shadow text-white z-10"
        :class="classes"
    >
        //menu context
    </ul>
    data() {
        return {
            isOpen: false
        };
    },







Related Posts

串串AIP Again~

串串AIP Again~

【Day 4】Docker 架構與底層實現

【Day 4】Docker 架構與底層實現

JavaScript: Execution Context & Closure

JavaScript: Execution Context & Closure




Sponsored



Comments