为路由规则开启props传参

index.js

props:true开启props传参

const router = new VueRouter({
  routes: [
      {path:'/movie/:mid',component:Movie,props:true}
  ]
})

Movies.vue

props接受传参

<template>
<div class="movie-container">

  <h3>Movie 组件{{mid}}</h3>
</div>
</template>
<script>
export default {
name: 'Movie',
props:['mid'],
}
</script>

 

posted @ 2021-09-15 23:00  ajaXJson  阅读(85)  评论(0编辑  收藏  举报