P32. vue-router 路由组件传参和不同的历史记录

路由组件传参

命名视图

image.png

ShopMain.vue


<template>
  <h2>shop 主要内容</h2>
</template>

<script>
export default {
  name: "ShopMain",
  props: ['id'],
  mounted() {
    console.log(this.id)
  }
}
</script>

<style scoped>

</style>

image.png

不同的历史记录

hash 模式

image.png

二者的区别是有无#

html5模式

image.png

image.png

#消失

image.png

评论

暂无评论