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

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
Jina AI
Jina AI
雷峰网
雷峰网
月光博客
月光博客
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
B
Blog RSS Feed
美团技术团队
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
A
Arctic Wolf
Latest news
Latest news
Attack and Defense Labs
Attack and Defense Labs
I
Intezer
F
Fortinet All Blogs
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
S
Secure Thoughts
Help Net Security
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
V
Visual Studio Blog
P
Proofpoint News Feed
博客园 - 【当耐特】
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
H
Help Net Security
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tenable Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog

博客园 - 工具人Kim哥

mysql数据库备份命令大全 在vscode下编译vue神坑40% building 过不去 PHP获取本周的每一天的时间 vue元素对齐方式 一个身高体重测量工具(BMI测量工具) HTML代码格式化实现方式 一个不错的常用小工具站点 Fiddler使用 不错的SDL源码分析 unity3d中获得物体的size PPT文化 Unity消息 Unity3D中的UnitySendMessage方法的使用 Android性能优化之渲染 问题记录 VS2012项目中使用CocoStudio相关文件的设置 国际金融基础知识 Nutch 安装文档 sed linux 命令
Vue获取url网址参数的两种方法
工具人Kim哥 · 2023-10-31 · via 博客园 - 工具人Kim哥

Vue 有两种方法可以方便地获取 url 的参数:

一种是在路由中配置了 path :

{
    path: '/detail/:id/',
    name: 'detail',
    component: detail,
    meta: {
        title: '详情'
    }
}

获取参数:

let id = this.$route.params.id注意:

1、参数名需要保持一致

2、如果路由中没有传参(https://chongfen.net/detail),会报错页面无法显示。正常链接应该为 https://chongfen.net/detail/234

如果有的参数可传可不传,可以使用 ? 传参:

https://www.chongfen.net/detail?id=16

获取方法:

let id = this.$route.query.id

这样即使取不到参数,页面也不会报错。

可以根据自己的需求使用不同的方法获取 url 参数。

 

posted @ 2023-10-31 14:45  工具人Kim哥  阅读(5133)  评论(0)    收藏  举报