Closed isanonymous closed 2 years ago
来自vue-router的props似乎无效
https://v3.router.vuejs.org/zh/guide/essentials/passing-props.html
路由定义
{ path: '/my_path', component: MyComp, props:rt=> {return ({dId:rt.query.dId, name:rt.query.name, code:rt.query.code})}, }
传参代码
setup(props, {attrs, emit, slots, root} ) { root.$router.push({path:'/my_path', query:{dId:'row.id', name:row.equipmentName, code:row.equipmentCode}}) }
vue代码
// 在<script setup>中 const props = defineProps({ dId:{type:String, required:true}, name:{type:String}, code:{type:[String,Number]}, }); // props中的3个属性都为undefined console.log("---proops---", props);
来自vue-router的props似乎无效
路由定义
传参代码
// props中的3个属性都为undefined
vue代码