Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!