Skip to content

Instantly share code, notes, and snippets.

@jaceju
Created July 5, 2018 03:22
Show Gist options
  • Save jaceju/8eaf69f9d8d75f5e0328710b6b3ace43 to your computer and use it in GitHub Desktop.
Save jaceju/8eaf69f9d8d75f5e0328710b6b3ace43 to your computer and use it in GitHub Desktop.
Element UI NavBar with Vue-Router
<template>
<el-menu :default-active="$route.path"
class="el-menu-demo"
mode="horizontal"
@select="handleSelect"
:router="true">
<el-menu-item index="/" route="/">Deploy Status</el-menu-item>
<el-menu-item index="/projects" route="/projects">Projects</el-menu-item>
<el-menu-item index="/services" route="/services">Services</el-menu-item>
</el-menu>
</template>
<script>
export default {
name: 'NavBar',
methods: {
handleSelect (key, keyPath) {
console.log(key, keyPath);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment