How to set fullcalendar selectable option based on current view?

<calendar
  ...
  :selectable="isSelectable"
  ref="calendar"
  />


  export default {
  components: {
    calendar
  },
  computed: {
    isSelectable () {
      return this.$refs.calendar.getApi().view.type !== 'dayGridMonth'
    }
  }
  ...

When I try this I get error: Cannot read property ‘getApi’ of undefined