Showing
1 changed file
with
56 additions
and
11 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-10-20 16:57:48 | 2 | * @Date: 2024-10-20 16:57:48 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-22 17:41:01 | 4 | + * @LastEditTime: 2024-10-25 15:39:59 |
| 5 | * @FilePath: /hager/src/views/search.vue | 5 | * @FilePath: /hager/src/views/search.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -20,13 +20,9 @@ | ... | @@ -20,13 +20,9 @@ |
| 20 | </div> | 20 | </div> |
| 21 | <div style="height: 5rem;"></div> | 21 | <div style="height: 5rem;"></div> |
| 22 | </el-tab-pane> | 22 | </el-tab-pane> |
| 23 | - <el-tab-pane name="news"> | 23 | + <el-tab-pane name="solution"> |
| 24 | - <div slot="label" class="customer-label">新闻 <span>3</span></div> | 24 | + <div slot="label" class="customer-label">解决方案 <span>3</span></div> |
| 25 | <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> | 25 | <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> |
| 26 | - <!-- <el-breadcrumb separator="/"> | ||
| 27 | - <el-breadcrumb-item>首页</el-breadcrumb-item> | ||
| 28 | - <el-breadcrumb-item>新闻中心</el-breadcrumb-item> | ||
| 29 | - </el-breadcrumb> --> | ||
| 30 | <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> | 26 | <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> |
| 31 | <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> | 27 | <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> |
| 32 | <div class="search-news-content" v-html="highlightKeyword(keyword, item.content)"></div> | 28 | <div class="search-news-content" v-html="highlightKeyword(keyword, item.content)"></div> |
| ... | @@ -36,8 +32,8 @@ | ... | @@ -36,8 +32,8 @@ |
| 36 | </div> | 32 | </div> |
| 37 | </div> | 33 | </div> |
| 38 | </el-tab-pane> | 34 | </el-tab-pane> |
| 39 | - <el-tab-pane name="solution"> | 35 | + <el-tab-pane name="success"> |
| 40 | - <div slot="label" class="customer-label">解决方案 <span>3</span></div> | 36 | + <div slot="label" class="customer-label">成功案例 <span>3</span></div> |
| 41 | <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> | 37 | <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> |
| 42 | <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> | 38 | <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> |
| 43 | <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> | 39 | <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> |
| ... | @@ -48,6 +44,22 @@ | ... | @@ -48,6 +44,22 @@ |
| 48 | </div> | 44 | </div> |
| 49 | </div> | 45 | </div> |
| 50 | </el-tab-pane> | 46 | </el-tab-pane> |
| 47 | + <el-tab-pane name="news"> | ||
| 48 | + <div slot="label" class="customer-label">新闻 <span>3</span></div> | ||
| 49 | + <div style="margin-top: 1rem;" v-for="(item, index) in news_list" :key="index"> | ||
| 50 | + <!-- <el-breadcrumb separator="/"> | ||
| 51 | + <el-breadcrumb-item>首页</el-breadcrumb-item> | ||
| 52 | + <el-breadcrumb-item>新闻中心</el-breadcrumb-item> | ||
| 53 | + </el-breadcrumb> --> | ||
| 54 | + <div :class="['search-news-wrapper', is_xs ? 'xs' : '']"> | ||
| 55 | + <div class="search-news-title" v-html="highlightKeyword(keyword, item.title)"></div> | ||
| 56 | + <div class="search-news-content" v-html="highlightKeyword(keyword, item.content)"></div> | ||
| 57 | + <div class="search-news-more"> | ||
| 58 | + <div class="search-news-more-btn" @click="goTo(item.id)">MORE</div> | ||
| 59 | + </div> | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + </el-tab-pane> | ||
| 51 | </el-tabs> | 63 | </el-tabs> |
| 52 | </hager-box> | 64 | </hager-box> |
| 53 | </div> | 65 | </div> |
| ... | @@ -87,18 +99,44 @@ export default { | ... | @@ -87,18 +99,44 @@ export default { |
| 87 | id: '', | 99 | id: '', |
| 88 | img: 'https://cdn.ipadbiz.cn/hager/img/product/t01.jpg', | 100 | img: 'https://cdn.ipadbiz.cn/hager/img/product/t01.jpg', |
| 89 | title: 'acb hw 空气断路器' | 101 | title: 'acb hw 空气断路器' |
| 90 | - }] | 102 | + }], |
| 103 | + is_end: false | ||
| 91 | } | 104 | } |
| 92 | }, | 105 | }, |
| 93 | watch: { | 106 | watch: { |
| 94 | '$route.query.keyword': function(newKeyword) { | 107 | '$route.query.keyword': function(newKeyword) { |
| 95 | this.keyword = newKeyword || ''; | 108 | this.keyword = newKeyword || ''; |
| 96 | - } | 109 | + }, |
| 97 | }, | 110 | }, |
| 98 | mounted () { | 111 | mounted () { |
| 99 | objectFitImages(this.$el); // 对当前组件的 DOM 元素应用 | 112 | objectFitImages(this.$el); // 对当前组件的 DOM 元素应用 |
| 113 | + if (this.is_xs) { // 自适应模式下,左右箭头的颜色修改 | ||
| 114 | + this.modifyTabColor(); | ||
| 115 | + } | ||
| 116 | + // 监听窗口的 resize 事件 | ||
| 117 | + window.addEventListener('resize', this.modifyTabColor); | ||
| 118 | + }, | ||
| 119 | + beforeDestroy() { | ||
| 120 | + // 在组件销毁前移除监听器,防止内存泄漏 | ||
| 121 | + window.removeEventListener('resize', this.modifyTabColor); | ||
| 100 | }, | 122 | }, |
| 101 | methods: { | 123 | methods: { |
| 124 | + modifyTabColor () { | ||
| 125 | + this.$nextTick(() => { | ||
| 126 | + setTimeout(() => { | ||
| 127 | + // next按钮修改颜色 | ||
| 128 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-next').css('color', '#F56400'); | ||
| 129 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-next').on('click', (e) => { | ||
| 130 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-next').css('color', '#333') | ||
| 131 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-prev').css('color', '#F56400') | ||
| 132 | + }) | ||
| 133 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-prev').on('click', (e) => { | ||
| 134 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-next').css('color', '#F56400') | ||
| 135 | + $('.el-tabs__nav-wrap').children('span.el-tabs__nav-prev').css('color', '#333') | ||
| 136 | + }) | ||
| 137 | + }, 100); | ||
| 138 | + }) | ||
| 139 | + }, | ||
| 102 | handleClick(tab, event) { | 140 | handleClick(tab, event) { |
| 103 | console.log(tab, event); | 141 | console.log(tab, event); |
| 104 | }, | 142 | }, |
| ... | @@ -237,4 +275,11 @@ export default { | ... | @@ -237,4 +275,11 @@ export default { |
| 237 | color: #F56400; | 275 | color: #F56400; |
| 238 | } | 276 | } |
| 239 | } | 277 | } |
| 278 | + | ||
| 279 | + :deep(.el-tabs__nav-prev) { | ||
| 280 | + font-size: 1rem; | ||
| 281 | + } | ||
| 282 | + :deep(.el-tabs__nav-next) { | ||
| 283 | + font-size: 1rem; | ||
| 284 | + } | ||
| 240 | </style> | 285 | </style> | ... | ... |
-
Please register or login to post a comment