question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

just not render , no error shows

See original GitHub issue

main.js

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'

// 路由VueRouter
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// 1. 定义(路由)组件。
// 可以从其他文件 import 进来
import indexComponent from './pages/App'
import projectsComponent from './pages/projects'

const index = indexComponent
const projects = projectsComponent
// 2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是
// 通过 Vue.extend() 创建的组件构造器,
// 或者,只是一个组件配置对象。
// 我们晚点在讨论嵌套路由。
const routes = [
  { path: '/', component: index },
  { path: '/projects', component: projects }
]
// 3. 创建 router 实例,然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
  routes // (缩写)相当于 routes: routes
})
// 4. 创建和挂载根实例。
// 记得要通过 router 配置参数注入路由,
// 从而让整个应用都有路由功能
/* eslint-disable no-new */
new Vue({
  router
}).$mount('#app')



Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
posvacommented, Mar 5, 2018

You’re probably going to a route that is not defined 🙂 Please, use the forum, the Discord server or StackOverflow for questions

1reaction
ragnarlotuscommented, Oct 13, 2016

Hello, it happened to me too. In the documentation just says to add the Vue.use(VueRouter) if using module system, but it is not enough. You will also have to do the following.

Replace: new Vue({ router }).$mount('#app') With: new Vue(Vue.util.extend({ router }, App)).$mount('#app');

Read more comments on GitHub >

github_iconTop Results From Across the Web

React doesn't render but no errors in console - Stack Overflow
Your issue is that it is ReactDOM not ReactDom. class App extends React.Component { render() { return <h1>Hello from our app</h1> } }...
Read more >
Unable to render class method in the App component ( No error)
Your class method is running and returning a value in the first example, but nothing in your code is doing anything with the...
Read more >
Suspense for Data Fetching (Experimental) - React
Approach 1: Fetch-on-Render (not using Suspense). A common way to fetch data in React apps today is to use an effect: // In...
Read more >
Error stops components from rendering, without error ... - GitHub
This feels like a bug. I had a faulty code - trying to bind undefined function (I forgot to pass it down from...
Read more >
How to Handle Errors in React - AppSignal Blog
React Error Boundaries ... Not only that, the whole page will be blank, and the user won't be able to do or see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found