File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * @Date : 2021-12-21 21:21:21
3
+ * @LastEditTime : 2021-12-21 21:21:23
4
+ * @FilePath : \imooc-blog\api\search.js
5
+ */
6
+ import request from "@/utils/request" ;
7
+
8
+ /**
9
+ * 默认搜索内容
10
+ */
11
+ export function getDefaultText ( ) {
12
+ return request ( {
13
+ url : "/search/default-text" ,
14
+ } ) ;
15
+ }
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-21 20:44:59
3
+ * @LastEditTime: 2021-12-21 21:22:21
4
4
* @FilePath: \imooc-bloge:\BlogDemo\imooc-uni-app\project\imooc-blog\subpkg\pages\search-blog\search-blog.vue
5
5
-->
6
6
<template >
25
25
</template >
26
26
27
27
<script >
28
+ import { getDefaultText } from " @/api/search" ;
28
29
export default {
29
30
data () {
30
31
return {
@@ -34,6 +35,9 @@ export default {
34
35
defaultText: " 默认的 placeholderText" ,
35
36
};
36
37
},
38
+ created () {
39
+ this .loadDefaultText ();
40
+ },
37
41
methods: {
38
42
/**
39
43
* 搜索内容
@@ -63,6 +67,13 @@ export default {
63
67
onSearchCancel (val ) {
64
68
console .log (" searchbar 取消按钮" );
65
69
},
70
+ /**
71
+ * 获取推荐搜索文本
72
+ */
73
+ async loadDefaultText () {
74
+ const { data: res } = await getDefaultText ();
75
+ this .defaultText = res .defaultText ;
76
+ },
66
77
},
67
78
};
68
79
</script >
You can’t perform that action at this time.
0 commit comments