|
@@ -1,82 +1,93 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <ul>
|
|
|
- <li :class="[{'active':type=='openService'}]" @click="changeNav('openService')"><i class="icon icon-hot"></i>热门游戏</li>
|
|
|
- <li :class="[{'active':type=='rank'}]" @click="changeNav('rank')"><i class="icon icon-serve"></i>开服动态</li>
|
|
|
- <li><i class="icon icon-rank"></i>排行榜</li>
|
|
|
- <li><i class="icon icon-all"></i>全部游戏</li>
|
|
|
- <li><i class="icon icon-chess"></i>趣味棋牌</li>
|
|
|
- <li><i class="icon icon-role"></i>角色扮演</li>
|
|
|
- <li><i class="icon icon-sports"></i>休闲竞技</li>
|
|
|
- <li><i class="icon icon-warfare"></i>战争策略</li>
|
|
|
- <li><i class="icon icon-simulate"></i>模拟经营</li>
|
|
|
- <li><i class="icon icon-legend"></i>传奇游戏</li>
|
|
|
- <li><i class="icon icon-try"></i>新游试玩</li>
|
|
|
- <li><i class="icon icon-kongfu"></i>武侠</li>
|
|
|
- <li><i class="icon icon-magic"></i>魔幻</li>
|
|
|
- <li><i class="icon icon-myth"></i>神话</li>
|
|
|
- <li><i class="icon icon-history"></i>历史</li>
|
|
|
- <li><i class="icon icon-knight"></i>仙侠</li>
|
|
|
- <li><i class="icon icon-compete"></i>竞技</li>
|
|
|
- <li><i class="icon icon-cartoon"></i>漫画</li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
+ <div>
|
|
|
+ <ul>
|
|
|
+ <li :class="[{'active':type==item.to}]" v-for="(item,index) in nav" :key="index" @click="changeNav(index)">
|
|
|
+ <i :class="`icon icon-${index}`"></i>
|
|
|
+ {{item.name}}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- data(){
|
|
|
- return {
|
|
|
- }
|
|
|
- },
|
|
|
- methods:{
|
|
|
- changeNav(type){
|
|
|
- this.$router.replace(`/list/${type}`)
|
|
|
- }
|
|
|
- },
|
|
|
- computed:{
|
|
|
- type(){
|
|
|
- return this.$route.params.type
|
|
|
- }
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ nav: {
|
|
|
+ hot: { name: "热门游戏", to: "popular" },
|
|
|
+ serve: { name: "开服动态", to: "openService" },
|
|
|
+ rank: { name: "排行榜", to: "rank" },
|
|
|
+ all: { name: "全部游戏", to: "allGame" },
|
|
|
+ chess: { name: "趣味棋牌", to: "allGame/chess" },
|
|
|
+ role: { name: "角色扮演", to: "allGame/role" },
|
|
|
+ sports: { name: "休闲竞技", to: "allGame/sports" },
|
|
|
+ warfare: { name: "战争策略", to: "allGame/warfare" },
|
|
|
+ simulate: { name: "模拟经营", to: "allGame/simulate" },
|
|
|
+ legend: { name: "传奇游戏", to: "allGame/legend" },
|
|
|
+ try: { name: "新游试玩", to: "allGame/try" },
|
|
|
+ kongfu: { name: "武侠", to: "allGame/kongfu" },
|
|
|
+ magic: { name: "魔幻", to: "allGame/magic" },
|
|
|
+ myth: { name: "神话", to: "allGame/myth" },
|
|
|
+ history: { name: "历史", to: "allGame/history" },
|
|
|
+ knight: { name: "仙侠", to: "allGame/knight" },
|
|
|
+ compete: { name: "竞技", to: "allGame/compete" },
|
|
|
+ cartoon: { name: "漫画", to: "allGame/cartoon" }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ changeNav(type) {
|
|
|
+ this.$router.replace(`/list/${this.nav[type].to}`);
|
|
|
}
|
|
|
-}
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ type() {
|
|
|
+ return this.$route.path.replace('/list/','');
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-$types:'hot','serve','rank','all','chess','role','sports','warfare','simulate','legend','knight','try','kongfu','myth','magic','history','compete','cartoon';
|
|
|
+$types: "hot", "serve", "rank", "all", "chess", "role", "sports", "warfare",
|
|
|
+ "simulate", "legend", "knight", "try", "kongfu", "myth", "magic", "history",
|
|
|
+ "compete", "cartoon";
|
|
|
|
|
|
-li{
|
|
|
- height: 34px;
|
|
|
- line-height: 34px;
|
|
|
- font-size: 14px;
|
|
|
- color: #333333;
|
|
|
- padding-left: 27px;
|
|
|
- cursor: pointer;
|
|
|
- border-left: 3px solid transparent;
|
|
|
- transition: all .2s;
|
|
|
- margin-bottom: 6px;
|
|
|
- &:hover,&.active{
|
|
|
- background-color: #fff3f3;
|
|
|
- border-color: #eb4c4c;
|
|
|
- color: #eb4c4c;
|
|
|
- @for $i from 1 through length($types) {
|
|
|
- .icon-#{nth($types, $i)} {
|
|
|
- background: url('./img/icon-#{nth($types, $i)}_active.png') center no-repeat;
|
|
|
- }
|
|
|
- }
|
|
|
+li {
|
|
|
+ height: 34px;
|
|
|
+ line-height: 34px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #333333;
|
|
|
+ padding-left: 27px;
|
|
|
+ cursor: pointer;
|
|
|
+ border-left: 3px solid transparent;
|
|
|
+ transition: all 0.2s;
|
|
|
+ margin-bottom: 6px;
|
|
|
+ &:hover,
|
|
|
+ &.active {
|
|
|
+ background-color: #fff3f3;
|
|
|
+ border-color: #eb4c4c;
|
|
|
+ color: #eb4c4c;
|
|
|
+ @for $i from 1 through length($types) {
|
|
|
+ .icon-#{nth($types, $i)} {
|
|
|
+ background: url("./img/icon-#{nth($types, $i)}_active.png")
|
|
|
+ center
|
|
|
+ no-repeat;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
-.icon{
|
|
|
- display: inline-block;
|
|
|
- width: 20px;
|
|
|
- height: 20px;
|
|
|
- vertical-align: middle;
|
|
|
- margin-right: 12px;
|
|
|
+.icon {
|
|
|
+ display: inline-block;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 12px;
|
|
|
}
|
|
|
|
|
|
@for $i from 1 through length($types) {
|
|
|
-.icon-#{nth($types, $i)} {
|
|
|
- background: url('./img/icon-#{nth($types, $i)}.png') center no-repeat;
|
|
|
- }
|
|
|
+ .icon-#{nth($types, $i)} {
|
|
|
+ background: url("./img/icon-#{nth($types, $i)}.png") center no-repeat;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|