|
|
@@ -37,8 +37,11 @@
|
|
|
<div class="search-hot">
|
|
|
<ul class="list-untyled">
|
|
|
<li class="item item-first">热门搜索</li>
|
|
|
- <li class="item" v-for="w in hotwords">
|
|
|
- <nuxt-link :to="w.url" target="_blank">{{ w.name }}</nuxt-link>
|
|
|
+ <li class="item" v-for="w in hotBrand">
|
|
|
+ <nuxt-link :to="'/product/brand/' + w.uuid" target="_blank">{{ w.nameCn }}</nuxt-link>
|
|
|
+ </li>
|
|
|
+ <li class="item" v-for="w in hotDevice">
|
|
|
+ <nuxt-link :to="'/product/brand/' + w.uuid" target="_blank">{{ w.code }}</nuxt-link>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
@@ -59,7 +62,20 @@
|
|
|
searchType: 'product'
|
|
|
}
|
|
|
},
|
|
|
+ fetch ({ store }) {
|
|
|
+ return Promise.all([
|
|
|
+ store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize }),
|
|
|
+ store.dispatch('newsData/loadHotNews')
|
|
|
+ ])
|
|
|
+ },
|
|
|
computed: {
|
|
|
+ hotDevice () {
|
|
|
+ console.log(this.$store.state.hotSearchDevice.hot.data)
|
|
|
+ return this.$store.state.hotSearchDevice.hot.data
|
|
|
+ },
|
|
|
+ hotBrand () {
|
|
|
+ return this.$store.state.hotSearchBrand.hot.data
|
|
|
+ },
|
|
|
similarKeywords () {
|
|
|
return this.$store.state.search.keywords
|
|
|
},
|
|
|
@@ -70,26 +86,6 @@
|
|
|
(this.similarKeywords.data.brand || this.similarKeywords.data.component || this.similarKeywords.data.kind)
|
|
|
}
|
|
|
},
|
|
|
- props: {
|
|
|
- hotwords: {
|
|
|
- type: Array,
|
|
|
- default () {
|
|
|
- return [{
|
|
|
- name: 'SCT2080KEC',
|
|
|
- url: '/product/component/1100400300009990'
|
|
|
- }, {
|
|
|
- name: '电池组',
|
|
|
- url: '/product/kind/346'
|
|
|
- }, {
|
|
|
- name: 'Vishay',
|
|
|
- url: '/product/brand/30327265e42a871be050007f01003d96'
|
|
|
- }, {
|
|
|
- name: 'Panasonic',
|
|
|
- url: '/product/brand/30327265e47d871be050007f01003d96'
|
|
|
- }]
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
watch: {
|
|
|
'keyword': {
|
|
|
handler (val, oldVal) {
|
|
|
@@ -174,10 +170,12 @@
|
|
|
},
|
|
|
created () {
|
|
|
this.$store.dispatch('resetSearchKeywords')
|
|
|
+ this.$store.dispatch('loadHotSearchDevice')
|
|
|
+ this.$store.dispatch('loadHotSearchBrand')
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-<style lang="scss" scoped>
|
|
|
+<style lang="scss" scoped type="text/scss">
|
|
|
@import '~assets/scss/variables';
|
|
|
.form-control{
|
|
|
border-radius: 0;
|
|
|
@@ -207,16 +205,27 @@
|
|
|
width: 79px;
|
|
|
border-radius: 0;
|
|
|
}
|
|
|
+ .search-hot ul{
|
|
|
+ line-height: 12px;
|
|
|
+ }
|
|
|
.search-hot ul li a{
|
|
|
color: #838383;
|
|
|
}
|
|
|
.search-hot {
|
|
|
+ margin-top:5px;
|
|
|
.item {
|
|
|
display: inline-block;
|
|
|
+ width:22%;
|
|
|
font-size: $font-size-small;
|
|
|
- margin-right: $pad;
|
|
|
-
|
|
|
+ padding-right: $pad;
|
|
|
+ a{
|
|
|
+ display:block;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
&.item-first {
|
|
|
+ width:12%;
|
|
|
color: $red;
|
|
|
}
|
|
|
}
|