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