Reputation: 345
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'.
Upvotes: 6
Views: 4768
Reputation: 1
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()
},
...
}
}
Upvotes: 4