I do not know why, I pass transmission parms it is wrong, uncomfortable
Here is the code
Data page display
//这个是点击事件,用来传递参数
<el-button size="mini" style="margin-right: 2px" type="text" @click.native.prevent="getId(scope.row.id,scope.row.scripttitle,scope.row.scriptcontent)">
编辑
</el-button>
//下面是methods中的方法
getId(id,scripttitle,scriptcontent){
this.$router.push({
path:'/broad/manuscript/scriptedit', //这个是你要跳转的路径
query:{ //我用是的query方式,不知为啥params方法不行
id : id,
scripttitle : scripttitle,
scriptcontent : scriptcontent,
}
})
}
The following is the code back to the significant data
export default{
created(){
this.getParams()
},
watch: {
'$route': 'getParams'
},
methods: {
getParams () {
// 取到路由带过来的参数
const id = this.$route.query.id;
const _this = this;
_this.form.scripttitle = this.$route.query.scripttitle;
_this.form.scriptcontent = this.$route.query.scriptcontent;
// 将数据放在当前组件的数据内
}
}
}