url div localhost 学习 lin emp 组件 style pan
如果组件通过query来传递num参数为1,相当与在 url 地址后面拼接参数
- <template>
- <div>
- <h3>首页</h3>
- <router-link :to="{ path:‘/home/chee‘, query: { num: 1} }">
- <button>点击<tton>
- </router-link>
- <router-view></router-view>
- </div>
- </template>
这是子路由中通过 this.$route.query.num 来显示传递过来的参数URL显示(http://localhost:8080/#/home/chee?num=1)
- <template>
- <h3>农药王者{{ this.$route.query.num }}</h3>
- </template>
vue路由传参(学习心得)
来源: http://www.bubuko.com/infodetail-2328574.html