viewweiwu / vue3-tabs-chrome

chrome tab like.
99 stars 28 forks source link

addTab within js #17

Closed cherimo closed 1 year ago

cherimo commented 1 year ago

Hi, how can I add tab within JS? I can't call addTab without importing it first right?

<script setup>
import Vue3TabsChrome from 'vue3-tabs-chrome'
import 'vue3-tabs-chrome/dist/vue3-tabs-chrome.css'
import { defineComponent, reactive, ref } from 'vue'

const tabs = reactive([
        {
          label: 'Dashboard',
          key: 'dashboard',
          dragable: false,
          swappable: false,
          closable: false,
        },
])

const tab = ref('dashboard')

</script>
viewweiwu commented 1 year ago

https://viewweiwu.github.io/vue3-tabs-chrome/ Here are some examples of use.

const handleAdd = () => {
  const key = 'tab' + Date.now()
  tabRef.value.addTab({
    label: 'New Tab',
    key
  })
  tab.value = key
}
cherimo commented 1 year ago

https://viewweiwu.github.io/vue3-tabs-chrome/ Here are some examples of use.

const handleAdd = () => {
  const key = 'tab' + Date.now()
  tabRef.value.addTab({
    label: 'New Tab',
    key
  })
  tab.value = key
}

Thanks it worked