Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
Loading same two pages when rendering with Vue

When I put some text on search and click on the button to render a new view for the search result, I get two same pages. So for example, when I type in AMZN, I go to the stocks/AMZN page, but when I press "back", the same stocks/AMZN page loads. When I click on "back" once more, then I am back to my initial page.

How can I make just one page to render?

I am using Vue, and here is my code.

Below is the script part of my .vue file.

  data() {
    return {
      tickerSymbol: null,
      stock: {},
      summaryReadMore: false,
    };
  },
  created() {
    this.fetchProfile();
  },
  methods: {
    fetchProfile() {
      this.tickerSymbol = this.$route.params.symbol;
      axios.get(`${import.meta.env.VITE_SBT_PERFORMANCE_SERVICE_URL}/stocks/${this.tickerSymbol}`)
        .then(resp => { 
          this.stock = resp.data;
        });
    },
    redirectToNewProfile() {
      this.$router.push({ name: 'Stocks', params: {symbol: this.$refs.searchItem.value} })
    },

And below is my html part of my .vue file:

      <form v-on:submit="redirectToNewProfile()">
        <div class="shadow flex">
          <input class="w-full rounded p-2" type="text" placeholder="Search..." ref="searchItem"
          v-on:keyup.enter.prevent="redirectToNewProfile()">
          <button class="bg-white w-auto flex justify-end items-center text-blue-500 p-2 hover:text-blue-400">
              <i class="material-icons">search</i>
          </button>
        </div>
      </form>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda