Tailwind UI dropdown with Vue.js TASK STATUS

https://tailwindui.com/components/application-ui/elements/dropdowns

by ChangJoo Park

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.0.2/tailwind.min.css">
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<!-- App Shell -->
<div id="app" class="flex flex-col justify-center items-center w-screen h-screen">
  <!-- This example requires Tailwind CSS v2.0+ -->
  <div class="relative inline-block text-left">
    <div>
      <button @click="toggle" type="button" class="inline-flex items-center justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-indigo-500" id="options-menu" aria-haspopup="true" aria-expanded="true">
        {{ currentStatus.label }}
        <!-- Heroicon name: solid/chevron-down -->
        <svg class="-mr-1 ml-2 h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
          <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
        </svg>
      </button>
    </div>

    <!--
      Dropdown panel, show/hide based on dropdown state.

      Entering: "transition ease-out duration-100"
        From: "transform opacity-0 scale-95"
        To: "transform opacity-100 scale-100"
      Leaving: "transition ease-in duration-75"
        From: "transform opacity-100 scale-100"
        To: "transform opacity-0 scale-95"
    -->
    <transition enter-active-class="transition ease-out duration-100" enter-class="transform opacity-0 scale-95" enter-to-class="transform opacity-100 scale-100" leave-active-class="transition ease-in duration-75" leave-class="transform opacity-100 scale-100" leave-to-class="transform opacity-0 scale-95">
      <div v-if="isOpen" class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black...

JavaScript

const STATUS = [{
    key: 'IDEA',
    label: 'IDEA'
  },
  {
    key: 'ARCHIVED',
    label: 'ARCHIVED'
  },

  {
    key: 'TODO',
    label: 'TODO'
  },

  {
    key: 'DOING',
    label: 'DOING'
  },

  {
    key: 'DONE',
    label: 'DONE'
  },

]

new Vue({
  el: "#app",
  data() {
    return {
      isOpen: false,
      currentStatus: STATUS.TODO,
      status: STATUS
    }
  },
  mounted() {
    console.log('mounted')
  },
  methods: {
    toggle() {
      this.isOpen = !this.isOpen
    },
    select(status) {
      this.currentStatus = status
      this.isOpen = false
    }
  }
})