vue 重定向和组件传参
重定向
通过配置index.js 使得匹配到一些路径直接重定向到某一个地方
带逻辑判断跳转
带参数跳转
组件传参
布尔模式
如果 props 被设置为 true,route.params 将会被设置为组件属性。
在index.js添加props true
组件这里即可直接使用
<template>
<div>
<h3>User ID :{{id}}</h3>
<router-view/>
</div>
</template>
<script>
export default {
name: "Users",
props : {
id : {
type:Number
}
}
}
</script>
<style scoped>
</style>