X
X
xlo2402019-12-02 22:01:57
Vue.js
xlo240, 2019-12-02 22:01:57

Why does it say is not a function when calling a function?

why in this example vue writes an error this.load2 is not a function ?

mounted() {
    console.log('mounted')
    this.load2()
  },
  
  load2() {
    console.log('load2')
  },

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex Pospeliri, 2019-12-03
@xlo240

load2 - should be in

methods: {
  load2() {
    console.log('load2')
  }
}

A
Andrey Suha, 2019-12-02
@andreysuha

Maybe because load2 is not present in the vue instance? You just need to understand what to do to make it appear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question