vue 獲取url后面的參數


1   獲取?后面的參數

      http://192.168.1.105:8080/#/idInput?username=%22%E5%BC%A0%E4%B8%89%22

     獲取參數方法     let id = this.$route.query.username

2 獲取不帶?的URL中的參數

      http://192.168.1.12:8080/#/home/newsinfo/234

    在路由中配置路由

    { path: '/home/newsinfo/:id', component: Newsinfo }

     .vue頁面設置

    <template>

          <router-link :to="'/home/newsinfo/' + item.id">

    </template>

     獲取參數方法    let id = this.$route.params.id


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM