标签:ret header head contain menu item def com element
<template> <div id="app"> <el-container> <el-header> <el-menu :default-active="onRoutes" mode="horizontal" @select="handleSelect" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" :router="true"> <el-menu-item index="/home">首页</el-menu-item> <el-menu-item index="/freeCourse">免费课程</el-menu-item> </el-menu> </el-header> <el-main> <router-view /> </el-main> </el-container> </div> </template> <script> export default { name: ‘App‘, data() { return { } }, methods: { //打印el-menu-item的index,path handleSelect(index, path) { console.log(index, path); } }, computed: { onRoutes() { //刷新后保存默认激活样式 let path = this.$route.path; return path; } } } </script> <style> </style>
标签:ret header head contain menu item def com element
原文地址:https://www.cnblogs.com/staff/p/11819044.html