1、编写header组件,两个按钮对应两个路由跳转
<template>
<div class="z-header">
<button @click="redirect('/p1')">菜单1</button>
<button @click="redirect('/p2')">菜单2</button>
</div>
</template>
<script>
export default {
name: "Header",
methods:{
redirect(path){
this.$router.push({
path:path})
}
}
}
</script>
<style scoped>
.z-header {
height: 100px;
width: 100<