File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
components/search-hot-list Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
<!--
2
2
* @Date: 2021-12-21 21:51:50
3
- * @LastEditTime: 2021-12-22 17:36:31
3
+ * @LastEditTime: 2021-12-22 17:59:27
4
4
* @FilePath: \imooc-blog\components\search-hot-list\search-hot-list.vue
5
5
-->
6
6
<template >
7
7
<view class =" search-hot-list-container" >
8
8
<!-- 标题 -->
9
9
<view class =" search-hot-title" >慕课热搜 - 全网技术 一网打尽</view >
10
10
<block v-for =" (item, index) in hotList" :key =" index" >
11
- <view class =" search-hot-item" >
11
+ <view class =" search-hot-item" @click = " onItemClick(item) " >
12
12
<!-- 序号 -->
13
13
<hot-ranking :ranking =" index + 1" ></hot-ranking >
14
14
<!-- 文本 -->
@@ -46,6 +46,12 @@ export default {
46
46
this .hotList = res .list ;
47
47
console .log (this .hotList );
48
48
},
49
+ /**
50
+ * item 点击事件
51
+ */
52
+ onItemClick (item ) {
53
+ this .$emit (" onSearch" , item .label );
54
+ },
49
55
},
50
56
};
51
57
</script >
Original file line number Diff line number Diff line change 14
14
word-break : break-all ;
15
15
}
16
16
17
+ .line-clamp {
18
+ white-space : normal ;
19
+ overflow : hidden ;
20
+ text-overflow : ellipsis ;
21
+ display : -webkit-box ;
22
+ -webkit-box-orient : vertical ;
23
+ -webkit-line-clamp : 1 ;
24
+ word-break : break-all ;
25
+ }
26
+
17
27
// 卡片视图
18
28
.card {
19
29
border : 1px solid #f9f9f9 ;
Original file line number Diff line number Diff line change 1
1
<!--
2
2
* @Date: 2021-12-21 16:33:53
3
- * @LastEditTime: 2021-12-22 17:35:06
3
+ * @LastEditTime: 2021-12-22 18:00:12
4
4
* @FilePath: \imooc-bloge:\BlogDemo\imooc-uni-app\project\imooc-blog\subpkg\pages\search-blog\search-blog.vue
5
5
-->
6
6
<template >
24
24
<!-- 热搜列表 -->
25
25
<view class =" search-hot-list-box card" v-if =" showType === HOT_LIST" >
26
26
<!-- 列表 -->
27
- <search-hot-list />
27
+ <search-hot-list @onSearch = " onSearchConfirm " />
28
28
</view >
29
29
<!-- 搜索历史 -->
30
30
<view class =" search-history-box" v-else-if =" showType === SEARCH_HISTORY" >
You can’t perform that action at this time.
0 commit comments