当前位置:网站首页>Router view cannot be rendered (a very low-level error)
Router view cannot be rendered (a very low-level error)
2022-07-29 00:23:00 【Little Deng programmer who can write bugs】
A problem encountered in writing code today ,
router-view It can't be rendered . I checked it carefully , I can't see the problem , After looking carefully for a long time .
It turned out to be a spelling mistake .
In addition, I see other centralized reasons on the Internet , It may lead to unsuccessful rendering
1.to The value of the attribute should be the same as that in the route path Have the same value
2. Import and export
vue-router website :https://router.vuejs.org/zh/
Official website entry case :
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/[email protected]"></script>
<div id="app">
<h1>Hello App!</h1>
<p>
<!-- Use router-link Components for navigation -->
<!-- By passing `to` To specify the link -->
<!--`<router-link>` A with the correct `href` Attribute `<a>` label -->
<router-link to="/">Go to Home</router-link>
<router-link to="/about">Go to About</router-link>
</p>
<!-- Route exit -->
<!-- The component to which the route matches is rendered here -->
<router-view></router-view>
</div>
// 1. Define routing components .
// You can also import from other files
const Home = {
template: '<div>Home</div>' }
const About = {
template: '<div>About</div>' }
// 2. Define some routes
// Each route needs to be mapped to a component .
// We will discuss nested routing later .
const routes = [
{
path: '/', component: Home },
{
path: '/about', component: About },
]
// 3. Create a routing instance and pass `routes` To configure
// You can enter more configurations here , But we're here
// Keep it simple for a while
const router = VueRouter.createRouter({
// 4. The interior provides history The realization of pattern . For the sake of simplicity , We use it here hash Pattern .
history: VueRouter.createWebHashHistory(),
routes, // `routes: routes` Abbreviation
})
// 5. Create and mount the root instance
const app = Vue.createApp({
})
// Make sure _use_ Routing instance makes
// The whole application supports routing .
app.use(router)
app.mount('#app')
// Now? , The app has started !
Tutorial code given by the official website , For reference only
边栏推荐
- MySQL安装配置教程(超级详细、保姆级)
- Dynamic programming problem (4)
- Advanced area of attack and defense world web masters supersqli
- Concurrency in go
- Okaleido ecological core equity Oka, all in fusion mining mode
- Google browser, no installation required
- Oracle super full SQL, details crazy
- Virtual lab basic experiment tutorial -8. Fourier transform (1)
- 2022网络安全学习路线 非常详细 推荐学习
- Idea2021.2 installation and configuration (continuous update)
猜你喜欢

Locally connect to redis on Windows Server

Servlet operation principle_ API details_ Advanced path of request response construction (servlet_2)

动态规划问题(七)

分布式限流 redission RRateLimiter 的使用及原理

110 MySQL interview questions and answers (continuously updated)

AutoCAD -- import excel tables into CAD and merge CAD

How can Plato obtain premium income through elephant swap in a bear market?

With this, your messages can't be monitored

Advanced area of attack and defense world web masters unserialize3

还在写大量 if 来判断?一个规则执行器干掉项目中所有的 if 判断...
随机推荐
Introduction and solution of common security vulnerabilities in web system CSRF attack
PTA (daily question) 7-70 diamond
CV semantic segmentation model sketch (2)
Develop effective Tao spell
Dynamic programming (V)
Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track
Event extraction and documentation (2018)
Install MySQL using Yum for Linux
动态规划问题(七)
Advanced area of attack and defense world web masters warmup
Dynamic programming problem (6)
Intelligent trash can (VII) -- Introduction and use of sg90 steering gear (Pico implementation of raspberry pie)
With this, your messages can't be monitored
Everything you have learned will come in handy at some point in your life (turn)
Newscenter, advanced area of attack and defense world web masters
【微服务~Nacos】Nacos服务提供者和服务消费者
Sword finger offer 41. median in data flow
DCAT in laravel_ Admin preliminary use record
Real time data warehouse: Didi's real-time data warehouse landing practice
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R