惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
腾讯CDC
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
L
LINUX DO - 热门话题
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
C
Cisco Blogs
A
Arctic Wolf
Latest news
Latest news
Jina AI
Jina AI
P
Proofpoint News Feed
博客园 - 叶小钗
Vercel News
Vercel News
T
Threat Research - Cisco Blogs
博客园 - 三生石上(FineUI控件)
K
Kaspersky official blog
C
Check Point Blog
H
Heimdal Security Blog
博客园 - Franky
小众软件
小众软件
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
aimingoo的专栏
aimingoo的专栏
Project Zero
Project Zero
G
GRAHAM CLULEY
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Scott Helme
Scott Helme
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
NISL@THU
NISL@THU

博客园 - IT-caijw

claude + trae Redis 介绍与 Node.js 使用教程 技术人日常避坑手册:高效工作,少踩坑 AI应用开发-本地大模型部署与API调用实战:LM Studio完整教程 Cursor AI 实用指南:10个具体示例 AI 是搭子不是替代者:我用大模型工具(cursor,trae)编程的一年经验总结 uniapp 闪屏页被拉伸解决方案 9图制作 X-ECharts:Vue项目中数据可视化的终极利器 jsWebControl解决海康视频插件窗口遮挡层级问题 es6划重点 - IT-caijw - 博客园 Promise原理讲解 async+await应用(异步回调解决方案) - IT-caijw - 博客园 echarts 的日常(教学篇) - IT-caijw - 博客园 angularjs 基础 ## HBuilder MUI开发时genymotion模拟器连接Hbuilder vue05-REST 请求 vue06-single-file-component vue04-components vue03-directives 指令 vue02-filters-computer
vue07-router 路由
IT-caijw · 2018-02-25 · via 博客园 - IT-caijw

main.js

vue init webpack //选择router
import router from './router'
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
// 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'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

router/index.js

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Contact from '@/components/Contact'
import Friend from '@/components/Friend'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/Contact/:id/:name',
      name: 'Contact',
      props : true,//是否接受参数
      component: Contact
    },
    {
      path: '/Friend',
      name: 'Friend',
      component: Friend
    }
  ]
})

Contact.vue

<template>
	<div>
		<h1>contact</h1>
		{{id}} {{name}}
	</div>
</template>

<script>
	export default {
		props : [
			'id',
			'name'
		]
	}
</script>

代码在github上,如果觉得有帮助请给我星星

源代码下载