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

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - 工具人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)    收藏  举报