下拉選單內容 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
        };
    },







你可能感興趣的文章

Leetcode 刷題 pattern - Merge Intervals

Leetcode 刷題 pattern - Merge Intervals

30-Day LeetCoding Challenge 2020 April Week 5 || Leetcode 解題

30-Day LeetCoding Challenge 2020 April Week 5 || Leetcode 解題

Day 11 - Blackjack (First project!)

Day 11 - Blackjack (First project!)






留言討論