Created
December 10, 2020 23:07
-
-
Save Marlysson/8f639b597f8f7695ead0e6939ce80fc2 to your computer and use it in GitHub Desktop.
Chamada à métodos de uma classe ainda não carregada.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modelo | |
class Championship{ | |
static ranking = [] | |
static rounds = [] | |
static new(){ | |
Championship.ranking = TeamGenerator.generate() | |
return Championship | |
} | |
static first(){ | |
return Championship.ranking.slice(0,10) | |
} | |
static last(){ | |
return Championship.ranking.slice(10) | |
} | |
} | |
export default Championship | |
// Componente | |
<div class="ranking-table"> | |
<RankingSection :teams="championship.first()" /> // Aqui acusa erro que o championship está undefined. | |
<RankingSection :teams="championship.last()" /> | |
</div> | |
// Script do Componente | |
data(){ | |
return { | |
championship: null | |
} | |
}, | |
mounted(){ | |
this.championship = Championship.new() | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment