vue页面跳转并传参,如下为A页面跳转到详情页面并传递所需参数:
A页面:
//html
<el-table-column label="详情">
<template slot-scope="scope">
<div @click="handleEdit(scope.$index,scope.row)">
<i class="el-icon-arrow-right"></i>
</div>
</template>
</el-table-column>
//js
handleEdit(index, row) {
this.$router.push({
name: "Datails",//详情页面
query: {
classId: row.classId,
createdtime: row.createdtime
}
});
},
详情页面:
export default {
name: "Datails",
data() {
return {
}
},
methods:{
getlistData(){
console.log( this.$route.query.classId);//123
console.log( this.$route.query.createdtime );//2020-4-1
}
}
}