1
1
<script setup>
2
- import Navbar from ' vuepress-theme-hope/modules/navbar/components/Navbar.js'
3
- import { useThemeLocaleData } from ' vuepress-theme-hope/composables/index'
2
+ import Navbar from " vuepress-theme-hope/modules/navbar/components/Navbar.js" ;
3
+ import { useThemeLocaleData } from " vuepress-theme-hope/composables/index" ;
4
4
5
- const themeData = useThemeLocaleData ()
6
- const extraNavList = themeData .value .extra_nav || []
5
+ const themeData = useThemeLocaleData ();
6
+ const extraNavList = themeData .value .extra_nav || [];
7
7
</script >
8
8
9
9
<template >
10
10
<Navbar >
11
11
<template #endBefore >
12
- <Docsearch />
12
+ <!-- <Docsearch /> -->
13
+ <div class =" search-box" @click =" handleSearch" >
14
+ <div class =" search-input-wrapper" >
15
+ <div class =" search-icon" >
16
+ <i class =" iconfont icon-search" ></i >
17
+ </div >
18
+ <div class =" search-input" >搜索关键字</div >
19
+ </div >
20
+ </div >
21
+
13
22
<el-link
14
23
class =" extra-link"
15
24
:type =" item.type"
@@ -22,4 +31,80 @@ const extraNavList = themeData.value.extra_nav || []
22
31
</Navbar >
23
32
</template >
24
33
25
- <style scope></style >
34
+ <script >
35
+ export default {
36
+ methods: {
37
+ handleSearch () {
38
+ const s = document .getElementById (" meta-category" )? .innerText ;
39
+ const url = s ? " /form/search.html?s=" + s : " /form/search.html" ;
40
+ window .open (url, " _blank" );
41
+ }
42
+ }
43
+ };
44
+ < / script>
45
+
46
+ < style>
47
+ .search - box {
48
+ display: flex;
49
+ align- items: center;
50
+ justify- content: center;
51
+ background- color: #f8f8f8; /* 背景色 */
52
+ border- radius: 20px ; /* 圆角 */
53
+ padding: 0 0 .8em ; /* 缩小内边距 */
54
+ border: 1px solid rgba (230 , 249 , 255 , 0.15 );
55
+ cursor: pointer;
56
+ transition: all 0 .3s ;
57
+ }
58
+
59
+ .search - box: hover {
60
+ border: 1px solid var (-- theme- color);
61
+ .search - icon {
62
+ color: var (-- theme- color);
63
+ }
64
+ }
65
+
66
+ .search - input- wrapper {
67
+ display: flex;
68
+ align- items: center;
69
+ }
70
+
71
+ .search - input {
72
+ user- select: none;
73
+ background- color: transparent;
74
+ font- weight: 500 ;
75
+ color: #999 ; /* 字体颜色 */
76
+ font- size: 14px ; /* 缩小字体大小 */
77
+ width: 100px ; /* 缩小输入框宽度 */
78
+ margin- left: 0 .4em ; /* 缩小间距 */
79
+ cursor: pointer;
80
+ }
81
+
82
+ .search - input:: placeholder {
83
+ color: #a0aec0; /* 占位符颜色 */
84
+ }
85
+
86
+ .search - icon {
87
+ display: flex;
88
+ align- items: center;
89
+ justify- content: center;
90
+ cursor: pointer;
91
+ color: #cbd5e0; /* 图标颜色 */
92
+ font- size: 14px ; /* 缩小图标大小 */
93
+ transition: color 0 .3s ;
94
+ }
95
+
96
+ .search - icon: hover {
97
+ color: var (-- theme- color); /* 悬停时的图标颜色 */
98
+ }
99
+
100
+ .iconfont {
101
+ font- size: 14px ; /* 缩小图标大小 */
102
+ }
103
+
104
+ /* 小屏幕隐藏输入框 */
105
+ @media (max - width : 900px ) {
106
+ .search - input {
107
+ display: none;
108
+ }
109
+ }
110
+ < / style>
0 commit comments