当前第2页 返回上一页
1 2 | this. $route .params.参数名
this. $route .query.参数名
|
实验(包含两种方式):
传递页:
1 2 3 4 5 6 7 8 9 | <router-link :to= "{ name: 'readDetail', params: { msgKeyOne: 'jump test.' }}" >
<button type= "button" >跳转</button>
</router-link><button @click= "sendParams" >传递</button>-----------------------------------------------------------------------------------------export default {
name: 'reads' ,
data () {
return {
msg: 'msg test.'
}
},
|
接收页:
1 2 3 4 5 6 7 8 9 10 11 12 | <div class = "container" >
<p style= "color:red;" >Num:{{ myIndex }}</p>
<p>{{ msg }}</p>
</div>-----------------------------------------------------------data () {
return {
msg: '' ,
myIndex: ''
}-----------------------------------------------------------mounted: function () {
this.msg = this. $route .params.msgKeyOne this.myIndex = this. $route .params.msgKey
console.log(this.myIndex)
}
|
相关免费学习推荐:javascript(视频)
以上就是vue.js如何带参数跳转的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
深入研究vue cli3
vue.js的优势是什么
vue.js开发环境怎么搭建
vue.js插槽有什么用
如何做到刷新vue.js改变数据
vue.js怎么改变样式
使用vue.js怎么定义全局变量
vue.js如何创建项目
vue.js怎么获取class
浅谈vue.js中的props(单向数据流)
更多相关阅读请进入《vue.js》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » vue.js如何带参数跳转