2016-06-23 11 views
0

VueJSを使用して、エラーapp.js:11754Uncaught TypeError: (intermediate value)(intermediate value).bind is not a functionを受け取ります。一度fullPageの内部で起動されたisLoaded関数を呼び出すことはできません。私は物事を働かせるために 'これ'をバインドする必要があることを知っているが、それは今まで働いていない。どこにバインド(これ)を置くべきですか?fullPageとVuejs内のセカンダリ関数のバインド

 one_page: function() { 
     $('#dosbcn').fullpage({ 
      anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'], 
      afterLoad: function(anchorLink, index){ 
       //using index 
       if(index == 2){ 
        console.log('second page here'); 
        this.isLoaded(); // Vue function to be called if the index is equal to 2. 
       } 
      } 
     }); 
    }, 
    isLoaded: function() { 
     console.log('hello world'); 
    } 
+0

は、時々私は、関数または行が終了していないときに、これらの問題を取得します';'をつけて。あなたのファイルはサーバ側で一緒に組み込み/結合されていますか? –

+0

この問題は、フルページの前に「this」と宣言していました。このように... 'var that = this;'次に 'that'を使う==>' that.isLoaded' –

+0

これを回答として投稿しますか? –

答えて

1

ので、同様に、私は目標と機能のこの外側を宣言するために必要な関数内VUEメソッドを呼び出すために:

 one_page: function() { 
     var that = this; // declare this as that here... 
     $('#dosbcn').fullpage({ 
      anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'], 
      afterLoad: function(anchorLink, index){ 
       //using index 
       if(index == 2){ 
        that.isLoaded(); 
       } 
      } 
     }); 
    }, 
    isLoaded: function() { 
     console.log('yep yep') 
    } 
関連する問題