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

385
Visualizações
Pasar valor en vuejs?

En detail.vue :

 data() { return { columns: [ { label: "name", field: "name", }, { label: "status", field: "status", }, row: [], }; }, // call Api created() { axios .get("/detail") .then((res) => { this.rows = res.data; }) .catch((error) => { console.log(error); }); }, methods: { detailFilter: function (name, status) { console.log(name, status) }, },

plantilla :

 <filter-list v-on:detail-filter="detailFilter" />

En Filter.vue

 data() { return { name: '', status: '', options: [ { label: 'Success', value: 'pending' }, { label: 'Fail', value: 'active' }, ], }; }, methods: { changeDetailFilter: function () { this.$emit( "detail-filter", this.name, this.status, ); localStorage.setItem('name', this.name); localStorage.setItem('status', JSON.stringify(this.status)) },

plantilla:

 <b-col md="3"> <b-form-group> <label>Name:</label> <b-form-input type="text" v-model="name" v-on:change="changeDetailFilter()" /> </b-form-group> </b-col> <b-col md="3"> <label>status:</label> <v-select :options="options" v-model="status" @input="changeDetailFilter()" /> </b-col>

Ahora quiero verificar created () con name y status , luego pasar parámetros para ello. por ejemplo:

 created() { axios .get("/detail",{ params: { name: name, status: status }, }) .then((res) => { this.rows = res.data; }) .catch((error) => { console.log(error); }); },

¿Hay alguna manera de pasar el nombre y el estado a created() , usando localStorage.getItem('name'); dame ideas gracias

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

@bueno tal vez algo como esto

 created() { let name = localStorage.getItem('name') let status = localStorage.getItem('status') // or if what you're fetching from localStorage is // an Object, // let someObject = JSON.parse(localStorage.getItem('someObject')). // then name could be someObject.name and status someObject.status axios .get("/detail",{ params: { name: name, status: status }, }) .then((res) => { this.rows = res.data; }) .catch((error) => { console.log(error); }); },
over 4 years ago · Santiago Trujillo Relatório
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