|
|
@@ -3,7 +3,8 @@
|
|
|
<div class="container">
|
|
|
<div class="shop-pcb">
|
|
|
<ul class="pk-list">
|
|
|
- <nuxt-link :to="`/pcb/search/?w=${encodeURIComponent(kind.nameCn)}`" tag="li" class="pk-item" v-for="kind in kinds" :key="kind.id">{{kind.nameCn}}<i class="icon-arrow-right iconfont"></i></nuxt-link>
|
|
|
+ <li class="pk-item" @click="setKindIds(null, -1)" :class="{active: selectedIndex === -1}">全部<i class="icon-arrow-right iconfont"></i></li>
|
|
|
+ <li @click="setKindIds(kind, index)" class="pk-item" :class="{active: selectedIndex === index}" v-for="(kind, index) in kinds" :key="kind.id">{{kind.nameCn}}<i class="icon-arrow-right iconfont"></i></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="pcb-banner">
|
|
|
@@ -16,6 +17,11 @@
|
|
|
<script>
|
|
|
export default {
|
|
|
name: 'store-banner',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ selectedIndex: -1
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
kinds () {
|
|
|
return this.$store.state.pcb.kindsData.kinds.data
|
|
|
@@ -23,6 +29,22 @@ export default {
|
|
|
storeInfo () {
|
|
|
return this.$store.state.shop.storeInfo.store.data
|
|
|
}
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ setKindIds (kind, index) {
|
|
|
+ let idsArr = []
|
|
|
+ if (kind) {
|
|
|
+ if (kind.children && kind.children.length) {
|
|
|
+ kind.children.forEach(item => {
|
|
|
+ idsArr.push(item.id)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ idsArr.push(kind.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.selectedIndex = index
|
|
|
+ this.$emit('kindAction', idsArr.join(','))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -44,19 +66,23 @@ export default {
|
|
|
line-height: 210px;
|
|
|
position: relative;
|
|
|
background: #fff;
|
|
|
- overflow: hidden;
|
|
|
.pk-list {
|
|
|
height:300px;
|
|
|
+ position: relative;
|
|
|
+ left: -1px;
|
|
|
+ width: 220px;
|
|
|
.pk-item{
|
|
|
- height:50px;
|
|
|
- line-height: 50px;
|
|
|
+ height:43px;
|
|
|
+ line-height:43px;
|
|
|
border-bottom:1px solid #e7e7e7;
|
|
|
cursor:pointer;
|
|
|
text-align: left;
|
|
|
color: #666;
|
|
|
padding-left:20px;
|
|
|
- &:hover{
|
|
|
- background: #e7e7e7;
|
|
|
+ &:hover,
|
|
|
+ &.active{
|
|
|
+ background: #2496f1;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
&:last-child{
|
|
|
border:none;
|