vue-router 跳转页面传递参数并获取参数-------query
发布日期:2022-02-08 04:20:44 浏览次数:2 分类:技术文章

本文共 789 字,大约阅读时间需要 2 分钟。

我也不知道为什么,我用parms传递传输就是不对,难受

下面是代码

 

 

显示数据的页面

//这个是点击事件,用来传递参数
编辑
//下面是methods中的方法getId(id,scripttitle,scriptcontent){ this.$router.push({ path:'/broad/manuscript/scriptedit', //这个是你要跳转的路径 query:{ //我用是的query方式,不知为啥params方法不行 id : id, scripttitle : scripttitle, scriptcontent : scriptcontent, } }) }

下面是回显数据的代码

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;      // 将数据放在当前组件的数据内    }  }}

 

转载地址:https://blog.csdn.net/weixin_38960774/article/details/104505734 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:字符串删除
下一篇:获取wangEditor编辑器的内容后,提交表单并获取编辑器的内容呢

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月18日 02时02分16秒