How can I get a dynamic id number for the jump between vue dynamic routes?

now there is a need to switch between dynamic routes (the actual route is the same address,: id is different), rather than the jump between different routes, so that the lifecycle function cannot be triggered and different id values cannot be obtained.

 <div class="child">
      <div></div>
      <ul>
        <router-link tag="li" :to=""/docLook/"+item.id" v-for="item in communityList" :key="item.id"
        >
          {{item.name}}
        </router-link>
      </ul>
      
      
      
     wacth:{
      id(){
        alert(this.id)
      }
    },
    mounted () {
      this.id =this.$route.params.id;

      },   
      

Apr.07,2021

watch routing id, handles logic according to id transformation


try to use the calculation property

---router.js---
{ path: 'changePwd/:id', component: changePwd},

---changePwd.vue---
computed:{
        id:function(){
            return this.$route.params.id
        }

    },

beforeRouteUpdate


you can use the watch method to listen for changes in route to get the latest id. For more information, please see vue-router 's official document ide/essentials/dynamic-matching.html-sharp%E5%93%8D%E5%BA%94%E8%B7%AF%E7%94%B1%E5%8F%82%E6%95%B0%E7%9A%84%E5%8F%98%E5%8C%96" rel=" nofollow noreferrer "> link description

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea9ce2-46a07.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea9ce2-46a07.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?