6
  • Quasar Framework v2 Beta
  • Vue 3 Composition Api
  • Typescript

component template

<q-btn 
  @click.stop="showingActionMenu()" 
  color="grey-7" 
  round 
  flat 
  icon="more_vert"
>
  <q-menu
    ref="showAction"
    auto-close
  >
    ...                       
  </q-menu>
</q-btn>
setup() {
  ...
  const showAction = ref<Function | null>(null)
  ...
})

component setup

return {
  ...
  showAction,
  showingActionMenu() {
    showAction?.value?.show()
  },
  ...
}

returned method shows error

Property 'show' does not exist on type 'Function'.

1 Answer 1

4

The type of the ref should be QMenu which is imported from quasar framework :

import { QMenu } from 'quasar'
...
setup() {
  ...
  const showAction = ref<QMenu>()
  ...
  return {
    ...
    showAction,
    showingActionMenu() {
      showAction.value?.show()
    },
    ...
  }
}

LIVE DEMO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.