Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Chamada à métodos de uma classe ainda não carregada.
// 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