query和params之间的区别

news/2024/7/19 15:07:23 标签: js

1.query要用path来引入,params要用name来引入

2.接收参数时,分别是this.$route.query.name和this.$route.params.name

3.query更加类似于ajax中get传参,而params类似与post,前者在浏览器的地址栏中显示,params不显示

4.params传值一刷新就没了,query传值刷新还存在。


http://www.niftyadmin.cn/n/482519.html

相关文章

VUE项目运行基本过程

main.js是项目的入口&#xff0c;webpack会根据main.js将所有js文件嵌入到打包后build文件夹下的index.html里。 build文件夹下&#xff0c;index.html的由来是由public下的index.html而来的&#xff0c; public下的index.html里有 <div id"app"></div>…

MongoDB错误:Command failed: mongorestore -h 127.0.0.1:27017 -d people ./src/doc/database --drop

错误信息: 错误原因&#xff1a;没有正常关闭MongoDB(应使用CtrlC关闭) 解决&#xff1a;打开服务启动即可 在命名行输入&#xff1a;npm start

数组常用方法总结

前言 数组的方法总结 一、可分类数组方法 1.添加类&#xff1a; var fruits[Apple,Banana] 添加元素到数组末尾&#xff1a;var newArray fruits.push(Orange) 添加元素到数组的头部&#xff1a;var newArrayfruits.unshift(Strawberry) 2.删除类&#xff1a; 删除末尾元素…

如何在新项目使用svg-icon组件 步骤

1.安装依赖npm i svg-sprite-loader4.1.3 2.配置 vue.config.js const path require(path) function resolve (dir) {return path.join(__dirname, dir) } 补充一个配置{ } const path require(path) function resolve (dir) {return path.join(__dirname, dir)module.exp…

reduce统计数组元素个数[“b“, “c“,“b“, “c“,“a“, “b“, “c“] 统计每个元素出现的次数,结果是: {a:1,b: 3, c: 3}

方法1&#xff1a; const arr ["b", "c","b", "c","a", "b", "c"] var obj arr.reduce( (item, index)> {if (index in item) {item[index]} else {item[index] 1}return item},{})console.log(…

把后端传过来的平铺数组数据处理为tree组件需要的树形数据

1.在src/utils/index.js文件中&#xff0c;补充一个函数tranListToTreeData /*** 把平铺的数组结构转成树形结构** [* {id:"01", pid:"", "name":"老王" },* {id:"02", pid:"01", "name":"小…

Element组件的Dialog弹框关闭的四种方式

在遮罩空白处点击。可以通过:close-on-click-modalfalse来关闭这个功能 按下esc键。可以通过:close-on-press-escapefalse来关闭这个功能 点击右上角的X按钮。可以通过:show-close"false"来隐藏这个按钮 自己定义的取消&#xff0c;关闭。核心是修改visiablefalse…