Skip to content

bug: Content ScrollToTop is not a function issue on browser #3

@jzenzinger

Description

@jzenzinger

I call IonContent scrollToTop method and console expections is thrown:
"Uncaught TypeError: content.value.scrollToTop is not a function".
I used ref from vue, but still same error.

However, it does not seem like this is possible in Vue right now: https://forum.vuejs.org/t/set-which-element-is-referenced-if-ref-is-set-from-parent/31480.

<ion-content :scroll-event="true" class="ion-padding-top" ref="myContent">

<!-- Fab button to scrollToTop  onClick -->
<ion-fab-button @click="handleFabClick" color="primary">
          <ion-icon :icon="arrowUpCircle"></ion-icon>
 </ion-fab-button>

methods: {
   handleFabClick() {
      // Not working properly as error show scrollToTop function is not defined but in IDE,
      // but in IDE it is defined as ionic function
      (this.$refs.myContent as any).scrollToTop(200);
    },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions