提交 4dfab83b 编写于 作者: Z Zachary

refactor: change NavMenu

上级 488c818a
...@@ -4,11 +4,14 @@ ...@@ -4,11 +4,14 @@
class="el-menu-demo" class="el-menu-demo"
mode="horizontal" mode="horizontal"
@select="handleSelect" @select="handleSelect"
background-color="#545c64" background-color="#f2f2f2"
text-colr="#fff" text-colr="#000"
active-text-color="#ffd04b"> active-text-color="#31c27c">
<el-menu-item v-for="(item, idx) in homeData" :key="item.title" :index="idx"> <el-menu-item
<router-link :to="item.path">{{item.title}}</router-link> v-for="(item, idx) in homeData" :key="item.title"
:index="idx.toString()"
@click="onClik(item.path)">
{{item.title}}
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
...@@ -19,8 +22,8 @@ ...@@ -19,8 +22,8 @@
name: 'NavMenu', name: 'NavMenu',
data() { data() {
return { return {
activeIndex: '1', activeIndex: '0',
activeIndex2: '1', activeIndex2: '0',
homeData:[ homeData:[
{title: '首页', path: '/MusicLibrary/home'}, {title: '首页', path: '/MusicLibrary/home'},
{title: '歌手', path: '/MusicLibrary/songers'}, {title: '歌手', path: '/MusicLibrary/songers'},
...@@ -36,14 +39,15 @@ ...@@ -36,14 +39,15 @@
methods: { methods: {
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
console.log(key, keyPath); console.log(key, keyPath);
} },
onClik(path) {
this.$router.push(path)
},
} }
} }
</script> </script>
<style lang="postcss" scoped> <style lang="postcss" scoped>
a {
text-decoration: none;
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册