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

231
Views
Why does vue-routers code break my project when i put its code into main.js?

I can't find an error in this code. I want to use a vue-router, but when I write the router code in main.js, nothing is displayed in the browser, and when I delete the router code, "Hello" appears in the browser, that is, the project starts working

main.js

import { createApp } from 'vue';
import App from './App.vue';
import {createRouter, createWebHistory}  from 'vue-router';

import gridPage from '../views/grid-page.vue'

const router = createRouter({
    // history: createWebHistory,
    routes: [
        {path: '/', name: 'Grid',  component:  gridPage},
    ]
});

createApp(App).use(router).mount('#app');//.createApp(App).use(router).mount('#app')

App.vue

<script>


</script>

<template>
<p>Hello</p>
  <router-view></router-view>
</template>

<style>

</style>

grid-page.vue

<script>

import grid from '../src/components/grid.vue'
import sidebar from '../src/components/sidebar.vue'

let idi = 0;

export default {
  components: {
        grid,
        sidebar
  },
  data() {
    return {
    
    }
  },
}
</script>

<template>
  <div class="root">
      <sidebar />
      <grid />
  </div>
</template>

<style>
.root{
  display: flex;
  height: auto;
}
</style>

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!