zoukankan      html  css  js  c++  java
  • vue 点击一条消息跳转相应的页面且对应相应的大模块和办理状态

    需求:点击一条消息跳转相应的页面且对应相应的大模块和办理状态为选中状态

    问题描述:点击一条消息后将需要改变的参数拼接到url地址中跳转到A页面,当将参数赋值给办理状态时页面办理状态不改变

    解决:使用watch监听属性监听url变化 && 给url加时间戳(防止缓存url没有改变watch监听不到)

    消息列表中点击事件中:

    handleRead (item, index) {
            let status = item.status
            let business_code = item.business_code
            let getTimestamp=new Date().getTime(); //加时间戳防止url没有改变watch监听不到
            this.$router.push({
              path:`/regulation/xzsp?status=${status}&business_code=${business_code}+${getTimestamp}`
            })
            this.$emit('handle-hide')
    }

    A页面中:

    watch:{
          $route(to, from) { // watch属性监听路由变化
            this.activeNameFn()
          }
    },
    methods:{
          activeNameFn(){
            if(this.$route.query.status!=undefined){
              this.activeName = this.$route.query.status
              this.business_code = this.$route.query.business_code
              console.log(this.activeName,'router')
            } else {
              this.activeName = 'DJ'
              console.log(this.activeName,'11')
            }
            console.log(this.activeName)
          },
    }
  • 相关阅读:
    谷雨路
    ObjectiveC_2.0大全.pdf iOS 5 Programming Cookbook http://www.devdiv.com
    http://www.120ask.com/zjamk/13/13658784.htm
    iPhone学习系列、代码教程___持续更新中
    30天精通iPhone手机编程
    font
    iPhone开发学习资料汇总
    tools
    http://blog.csdn.net/likendsl
    http://blog.csdn.net/iukey
  • 原文地址:https://www.cnblogs.com/duhui/p/13085210.html
Copyright © 2011-2022 走看看