Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

287
Visualizações
TypeScript Dynamic Classes (to be used at the end as Repository Pattern with Axios)

I've got suggested to use that way to define types (in Nuxt.js for all components manually and at the end, the data will be loaded with Axios using the "Repository Pattern"). For a small projects it's fine, but what about big projects with multiple data, types etc. Is there any way to automate it? Can i have some kind of "dynamic" Typescript classes?

Some data:

export const samplePage = [
    {
        buttons: [
            {
                size: 1,
                text: "Some text"
            }
        ]
    }
]

samplePage.model.ts

export class Button {
    size: number;
    text: string;

    constructor(button: Partial<Button> = {}) {
        this.size = 1;
       this.text = "";
    }
}

test.vue

<template>
  <div>
  </div>
</template>
<script lang="ts">
import { SamplePage } from "@/classes/models/samplePage.model"

import Vue from 'vue'
export default Vue.extend({
  data() {
    return {
        samplePage: samplePage
    }
  },
  mounted() {
    console.log("debug: samplePage", new SamplePage(this.samplePage[0]))
  },
  methods: {

  }
})
</script>
<style lang="scss" scoped>

</style>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda