VUE页面传参
创建跳转按钮
xxxxxxxxxx<template slot-scope="scope"> <el-button type="success" size="small" icon="el-icon-download" @click="connectHost(scope.row.id)">连接</el-button></template>本窗口传参
URL里传参
传参
path和query必须
xxxxxxxxxxconnectHost(id) { this.$router.push({ path: '/webterminal', name: 'WSTerminal', query: { hostid: id }})
接收
query
xxxxxxxxxx this.$route.query.hostidURL里隐藏参数
传参
name和query必须
xxxxxxxxxxconnectHost(id) { this.$router.resolve({ path: '/webterminal', name: 'WSTerminal', params: { hostid: id }}) 接收
params
xxxxxxxxxx this.$route.params.hostid新窗口传参
URL里传参
传参
xxxxxxxxxxconnectHost(id) { const newpage = this.$router.resolve({ path: '/webterminal', name: 'WSTerminal', query: { hostid: id }}) window.open(newpage.href, '_blank')
接收
query
xxxxxxxxxx this.$route.query.hostidURL里隐藏参数
传参
xxxxxxxxxxconnectHost(id) { const newpage = this.$router.resolve({ path: '/webterminal', name: 'WSTerminal', params: { hostid: id }}) const newWindow = window.open(newpage.href, '_blank') newWindow.hostid = id}接收
window
xxxxxxxxxx window.hostid
评论
发表评论