vuepress-theme-uniapp-official 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/DcloudSearchPage/components/Result.vue +131 -134
- package/components/DcloudSearchPage/components/Results.vue +4 -0
- package/components/DcloudSearchPage/index.styl +61 -45
- package/components/DcloudSearchPage/index.vue +397 -432
- package/global-components/SourceCode.vue +1 -1
- package/package.json +3 -3
|
@@ -1,104 +1,98 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<span class="DocSearch-Hit-title" v-html="hierarchyLvl1Html" />
|
|
10
|
-
<span v-if="item.content" class="DocSearch-Hit-path" v-html="contentHtml" />
|
|
11
|
-
</div>
|
|
2
|
+
<li :class="li_class">
|
|
3
|
+
<a :href="handleUrl(item.url)">
|
|
4
|
+
<div class="DocSearch-Hit-Container">
|
|
5
|
+
<div class="DocSearch-Hit-content-wrapper" v-if="item.hierarchy[item.type] && item.type === 'lvl1'">
|
|
6
|
+
<span class="DocSearch-Hit-title" v-html="hierarchyLvl1Html" />
|
|
7
|
+
<span v-if="item.content" class="DocSearch-Hit-path" v-html="contentHtml" />
|
|
8
|
+
</div>
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
<div v-else-if="isContent" class="DocSearch-Hit-content-wrapper">
|
|
11
|
+
<span class="DocSearch-Hit-title" v-html="contentHtml" />
|
|
12
|
+
<span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html || hierarchyLvl2Html" />
|
|
13
|
+
</div>
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/>
|
|
23
|
-
<span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html" />
|
|
24
|
-
</div>
|
|
15
|
+
<div v-else class="DocSearch-Hit-content-wrapper">
|
|
16
|
+
<span class="DocSearch-Hit-title" v-html="snippetResultContent(`hierarchy.${item.type}`)" />
|
|
17
|
+
<span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html" />
|
|
18
|
+
</div>
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
<span v-if="item.tag && item.tag !== 'uniCloud'" class="DocSearch-Hit-source_tag">
|
|
21
|
+
{{ item.tag }}
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
</a>
|
|
25
|
+
</li>
|
|
32
26
|
</template>
|
|
33
27
|
<script>
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
function getPropertyByPath(object, path) {
|
|
29
|
+
const parts = path.split('.');
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
return parts.reduce((prev, current) => {
|
|
32
|
+
if (prev && prev[current]) return prev[current];
|
|
33
|
+
return null;
|
|
34
|
+
}, object);
|
|
35
|
+
}
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
37
|
+
export default {
|
|
38
|
+
data() {
|
|
39
|
+
return {};
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
item: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: () => ({}),
|
|
45
|
+
},
|
|
46
|
+
index: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 0,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
li_class() {
|
|
53
|
+
return ['DocSearch-Hit', this.item.__docsearch_parent && 'DocSearch-Hit--Child']
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(' ');
|
|
56
|
+
},
|
|
57
|
+
isContent() {
|
|
58
|
+
return this.item.type === 'content';
|
|
59
|
+
},
|
|
60
|
+
contentHtml() {
|
|
61
|
+
return this.snippetResultContent('content');
|
|
62
|
+
},
|
|
63
|
+
hierarchyLvl1Html() {
|
|
64
|
+
return this.snippetResultContent('hierarchy.lvl1');
|
|
65
|
+
},
|
|
66
|
+
hierarchyLvl2Html() {
|
|
67
|
+
const lvl2 = this.snippetResultContent('hierarchy.lvl2');
|
|
68
|
+
return this.isContent ? this.contentHtml === lvl2 ? '' : lvl2 : '';
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
snippetResultContent(attribute) {
|
|
73
|
+
return (
|
|
74
|
+
getPropertyByPath(this.item, `_snippetResult.${attribute}.value`) ||
|
|
75
|
+
getPropertyByPath(this.item, attribute)
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
handleUrl(url) {
|
|
79
|
+
const len = url.length
|
|
80
|
+
const lastIndex = url.lastIndexOf('/')
|
|
81
|
+
if (lastIndex === len - 1) {
|
|
82
|
+
return url
|
|
83
|
+
}
|
|
84
|
+
const front = url.substring(0, lastIndex + 1)
|
|
85
|
+
const end = url.substring(lastIndex + 1)
|
|
86
|
+
if (end.indexOf('.html') > -1) {
|
|
87
|
+
return url
|
|
88
|
+
}
|
|
89
|
+
if (end.indexOf('#') > -1) {
|
|
90
|
+
return front + end.replace(/([\s\S]+)#([\s\S]+)/, '$1.html#$2')
|
|
91
|
+
}
|
|
92
|
+
return `${url}.html`
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
102
96
|
</script>
|
|
103
97
|
<style lang="stylus">
|
|
104
98
|
.DocSearch-Hit-source_tag {
|
|
@@ -110,51 +104,54 @@
|
|
|
110
104
|
margin-right: 5px;
|
|
111
105
|
font-weight: normal;
|
|
112
106
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
.DocSearch-Hit
|
|
108
|
+
border-radius 0px
|
|
109
|
+
display flex
|
|
110
|
+
padding-bottom 0px
|
|
111
|
+
position relative
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
&:not(:first-child)
|
|
114
|
+
border-top 1px solid #f5f6f7
|
|
121
115
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
116
|
+
a
|
|
117
|
+
background var(--docsearch-hit-background)
|
|
118
|
+
border-radius 0px
|
|
119
|
+
// box-shadow var(--docsearch-hit-shadow)
|
|
120
|
+
box-shadow none
|
|
121
|
+
display block
|
|
122
|
+
padding-left var(--docsearch-spacing)
|
|
123
|
+
width 100%
|
|
130
124
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
125
|
+
.DocSearch-Hit-Container
|
|
126
|
+
align-items center
|
|
127
|
+
color #444950
|
|
128
|
+
display flex
|
|
129
|
+
flex-direction row
|
|
130
|
+
height 56px
|
|
131
|
+
padding 0 12px 0 0
|
|
132
|
+
@media (max-width $MQMobile)
|
|
133
|
+
height 46px
|
|
134
|
+
padding 0 8px 0 0
|
|
138
135
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
136
|
+
.DocSearch-Hit-content-wrapper
|
|
137
|
+
overflow hidden
|
|
138
|
+
display flex
|
|
139
|
+
flex 1 1 auto
|
|
140
|
+
flex-direction column
|
|
141
|
+
font-weight 500
|
|
142
|
+
justify-content center
|
|
143
|
+
line-height 1.2em
|
|
144
|
+
margin 0 8px
|
|
145
|
+
overflow-x hidden
|
|
146
|
+
position relative
|
|
147
|
+
text-overflow ellipsis
|
|
148
|
+
white-space nowrap
|
|
149
|
+
width 80%
|
|
153
150
|
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
.DocSearch-Hit-title
|
|
152
|
+
font-size 0.9em
|
|
156
153
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
.DocSearch-Hit-path
|
|
155
|
+
// color $accentColor
|
|
156
|
+
font-size 0.75em
|
|
160
157
|
</style>
|
|
@@ -5,6 +5,7 @@ $svg-hover-color = #9b9b9b
|
|
|
5
5
|
@import './styles/ask.styl'
|
|
6
6
|
|
|
7
7
|
#search-container
|
|
8
|
+
font-size: 16px
|
|
8
9
|
position relative
|
|
9
10
|
overflow auto
|
|
10
11
|
position fixed
|
|
@@ -13,9 +14,63 @@ $svg-hover-color = #9b9b9b
|
|
|
13
14
|
left 0
|
|
14
15
|
top 0
|
|
15
16
|
z-index 200
|
|
16
|
-
background-color
|
|
17
|
+
background-color: rgba(0,0,0,0.4);
|
|
18
|
+
backdrop-filter: blur(4px);
|
|
17
19
|
|
|
18
|
-
.
|
|
20
|
+
.result-number
|
|
21
|
+
display flex
|
|
22
|
+
justify-content center
|
|
23
|
+
align-items center
|
|
24
|
+
padding 10px 0
|
|
25
|
+
font-size 20px
|
|
26
|
+
|
|
27
|
+
.uni-loading
|
|
28
|
+
width 27px
|
|
29
|
+
height 27px
|
|
30
|
+
|
|
31
|
+
.DocSearch-Logo
|
|
32
|
+
font-size 16px
|
|
33
|
+
vertical-align middle
|
|
34
|
+
display inline-block
|
|
35
|
+
|
|
36
|
+
.search-result
|
|
37
|
+
width 95%
|
|
38
|
+
// max-width 960px
|
|
39
|
+
margin 0 auto
|
|
40
|
+
padding: 10px;
|
|
41
|
+
box-sizing border-box
|
|
42
|
+
overflow-x: hidden;
|
|
43
|
+
background-color: $search-container-color
|
|
44
|
+
|
|
45
|
+
.result-wrap
|
|
46
|
+
ul
|
|
47
|
+
list-style none
|
|
48
|
+
margin 0
|
|
49
|
+
padding 0
|
|
50
|
+
|
|
51
|
+
.algolia-logo
|
|
52
|
+
display flex
|
|
53
|
+
justify-content center
|
|
54
|
+
padding 10px 0 20px
|
|
55
|
+
|
|
56
|
+
.search-more
|
|
57
|
+
display block
|
|
58
|
+
text-align center
|
|
59
|
+
padding 10px 0
|
|
60
|
+
color inherit
|
|
61
|
+
cursor pointer
|
|
62
|
+
|
|
63
|
+
&:hover
|
|
64
|
+
color $accentColor
|
|
65
|
+
|
|
66
|
+
.search-page-content
|
|
67
|
+
width: 90%;
|
|
68
|
+
margin: 20px auto 20px;
|
|
69
|
+
background-color: #fff;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
overflow hidden
|
|
72
|
+
.sub-navbar
|
|
73
|
+
background-color: $navbar-background-color
|
|
19
74
|
margin 0 auto
|
|
20
75
|
|
|
21
76
|
.search-wrap
|
|
@@ -111,51 +166,10 @@ $svg-hover-color = #9b9b9b
|
|
|
111
166
|
&
|
|
112
167
|
padding 0 1%
|
|
113
168
|
|
|
114
|
-
.result-number
|
|
115
|
-
display flex
|
|
116
|
-
justify-content center
|
|
117
|
-
align-items center
|
|
118
|
-
padding-top 20px
|
|
119
|
-
font-size 20px
|
|
120
|
-
|
|
121
|
-
.uni-loading
|
|
122
|
-
width 27px
|
|
123
|
-
height 27px
|
|
124
|
-
|
|
125
|
-
.DocSearch-Logo
|
|
126
|
-
font-size 16px
|
|
127
|
-
vertical-align middle
|
|
128
|
-
display inline-block
|
|
129
|
-
|
|
130
|
-
.search-result
|
|
131
|
-
width 80%
|
|
132
|
-
max-width 960px
|
|
133
|
-
margin 0 auto
|
|
134
|
-
box-sizing border-box
|
|
135
|
-
|
|
136
|
-
.result-wrap
|
|
137
|
-
ul
|
|
138
|
-
list-style none
|
|
139
|
-
margin 0
|
|
140
|
-
padding 0
|
|
141
|
-
|
|
142
|
-
.algolia-logo
|
|
143
|
-
display flex
|
|
144
|
-
justify-content center
|
|
145
|
-
padding 10px 0 20px
|
|
146
|
-
|
|
147
|
-
.search-more
|
|
148
|
-
display block
|
|
149
|
-
text-align center
|
|
150
|
-
padding 10px 0
|
|
151
|
-
color inherit
|
|
152
|
-
cursor pointer
|
|
153
|
-
|
|
154
|
-
&:hover
|
|
155
|
-
color $accentColor
|
|
156
169
|
|
|
157
170
|
@media (max-width $MQMobile)
|
|
158
171
|
#search-container
|
|
172
|
+
font-size: 14px
|
|
159
173
|
.search-navbar-header>.main-navbar
|
|
160
174
|
display none !important
|
|
161
175
|
|
|
@@ -180,4 +194,6 @@ $svg-hover-color = #9b9b9b
|
|
|
180
194
|
padding 0 10px
|
|
181
195
|
|
|
182
196
|
.search-result-aside
|
|
183
|
-
display none
|
|
197
|
+
display none
|
|
198
|
+
.result-number
|
|
199
|
+
font-size 14px
|