vuepress-theme-uniapp-official 1.4.11
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/README.md +22 -0
- package/components/AlgoliaSearchBox.vue +130 -0
- package/components/DcloudSearchPage/components/Result.vue +160 -0
- package/components/DcloudSearchPage/components/Results.vue +66 -0
- package/components/DcloudSearchPage/components/pagination.vue +155 -0
- package/components/DcloudSearchPage/index.styl +183 -0
- package/components/DcloudSearchPage/index.vue +500 -0
- package/components/DcloudSearchPage/styles/ask.styl +272 -0
- package/components/DcloudSearchPage/styles/ext.styl +68 -0
- package/components/DcloudSearchPage/utils/Base64.js +134 -0
- package/components/DcloudSearchPage/utils/mock.js +434 -0
- package/components/DcloudSearchPage/utils/postDcloudServer.js +141 -0
- package/components/DcloudSearchPage/utils/searchClient.js +101 -0
- package/components/DcloudSearchPage/utils/searchUtils.js +52 -0
- package/components/Footer.vue +142 -0
- package/components/MainNavbarLink.vue +57 -0
- package/components/NavLink.vue +95 -0
- package/components/NavLinks.vue +173 -0
- package/components/Navbar.vue +322 -0
- package/components/NavbarLogo.vue +24 -0
- package/components/OutboundLink.vue +45 -0
- package/components/SearchBox/dist/match-query.dev.js +61 -0
- package/components/SearchBox/index.vue +337 -0
- package/components/SearchBox/match-query.js +51 -0
- package/components/SearchBox/search.svg +1 -0
- package/components/SidebarGroup.vue +141 -0
- package/components/SidebarLink.vue +152 -0
- package/components/SidebarLinks.vue +106 -0
- package/components/SiderBarBottom.vue +134 -0
- package/components/Sticker.vue +64 -0
- package/components/Toc-top.vue +95 -0
- package/components/Toc.vue +165 -0
- package/config/copy.js +7 -0
- package/config/footer.js +195 -0
- package/config/i18n/index.js +2 -0
- package/config/navbar.js +163 -0
- package/config/redirectRouter.js +120 -0
- package/config/searchPage.js +48 -0
- package/config/siderbar/index.js +8 -0
- package/config/siderbar/uni-app.js +210 -0
- package/config/siderbar/uniCloud.js +55 -0
- package/config/toc.js +5 -0
- package/enhanceApp.js +142 -0
- package/global-components/CodeSimulator.vue +211 -0
- package/global-components/icons.js +647 -0
- package/global-components/iconsLayouts.vue +117 -0
- package/global-components/uniIcon.vue +85 -0
- package/global-components/uniicons.css +656 -0
- package/global-components/uniicons.ttf +0 -0
- package/index.js +152 -0
- package/layouts/404.vue +22 -0
- package/layouts/Layout.vue +238 -0
- package/layouts/SimpleLayout.vue +18 -0
- package/mixin/navInject.js +21 -0
- package/mixin/navProvider.js +65 -0
- package/mixin/toc.js +36 -0
- package/package.json +50 -0
- package/styles/custom-block.styl +336 -0
- package/styles/footer.styl +248 -0
- package/styles/index.styl +197 -0
- package/styles/navbar.styl +293 -0
- package/styles/palette.styl +9 -0
- package/util/index.js +317 -0
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
### uni-app official website theme for vuepress
|
|
2
|
+
|
|
3
|
+
# vuepress-theme-uni-app-test
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/vuepress-theme-uni-app-test) [](https://npmjs.com/package/vuepress-theme-uni-app-test)
|
|
6
|
+
|
|
7
|
+
## Sites
|
|
8
|
+
|
|
9
|
+
- clone this repo and run `yarn && yarn docs:dev`
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
yarn add vuepress-theme-uni-app-test -D
|
|
16
|
+
# OR npm install vuepress-theme-uni-app-test -D
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
[https://gitcode.net/dcloud/unidocs-uni-app-x-zh](https://gitcode.net/dcloud/unidocs-uni-app-x-zh)
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="docsearch">
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="DocSearch DocSearch-Button"
|
|
6
|
+
:aria-label="searchText"
|
|
7
|
+
@click="openSearch"
|
|
8
|
+
>
|
|
9
|
+
<span class="DocSearch-Button-Container">
|
|
10
|
+
<svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20">
|
|
11
|
+
<path
|
|
12
|
+
d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
fill="none"
|
|
15
|
+
fill-rule="evenodd"
|
|
16
|
+
stroke-linecap="round"
|
|
17
|
+
stroke-linejoin="round"
|
|
18
|
+
></path>
|
|
19
|
+
</svg>
|
|
20
|
+
<span class="DocSearch-Button-Placeholder">{{ searchText }}</span>
|
|
21
|
+
</span>
|
|
22
|
+
<span class="DocSearch-Button-Keys">
|
|
23
|
+
<span class="DocSearch-Button-Key">
|
|
24
|
+
<svg width="15" height="15" class="DocSearch-Control-Key-Icon">
|
|
25
|
+
<path
|
|
26
|
+
d="M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953"
|
|
27
|
+
stroke-width="1.2"
|
|
28
|
+
stroke="currentColor"
|
|
29
|
+
fill="none"
|
|
30
|
+
stroke-linecap="square"
|
|
31
|
+
></path>
|
|
32
|
+
</svg>
|
|
33
|
+
</span>
|
|
34
|
+
<span class="DocSearch-Button-Key">K</span>
|
|
35
|
+
</span>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
import '@docsearch/css';
|
|
42
|
+
import { LOCALE_ZH_HANS } from '@theme-config/i18n';
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
name: 'AlgoliaSearchBox',
|
|
46
|
+
|
|
47
|
+
computed: {
|
|
48
|
+
searchText() {
|
|
49
|
+
return this.$lang === LOCALE_ZH_HANS ? '搜索文档' : 'Search';
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
methods: {
|
|
54
|
+
openSearch() {
|
|
55
|
+
this.$parent.$refs.dcloudSearchPage.onSearchOpen();
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style lang="stylus">
|
|
62
|
+
.DocSearch
|
|
63
|
+
--docsearch-primary-color $accentColor
|
|
64
|
+
--docsearch-highlight-color var(--docsearch-primary-color)
|
|
65
|
+
--docsearch-searchbox-shadow inset 0 0 0 2px var(--docsearch-primary-color)
|
|
66
|
+
|
|
67
|
+
#docsearch
|
|
68
|
+
display flex
|
|
69
|
+
flex-direction column
|
|
70
|
+
justify-content center
|
|
71
|
+
#docsearch span
|
|
72
|
+
@media (min-width: 1200px)
|
|
73
|
+
&
|
|
74
|
+
display flex
|
|
75
|
+
|
|
76
|
+
@media (max-width: 1200px)
|
|
77
|
+
:root
|
|
78
|
+
--docsearch-spacing 10px
|
|
79
|
+
--docsearch-footer-height 40px
|
|
80
|
+
.DocSearch-Button-Keys,.DocSearch-Button-Key,.DocSearch-Button-KeySeparator,.DocSearch-Button-Placeholder
|
|
81
|
+
display none !important
|
|
82
|
+
.DocSearch-Search-Icon
|
|
83
|
+
vertical-align middle
|
|
84
|
+
.DocSearch-Dropdown
|
|
85
|
+
height 100%
|
|
86
|
+
.DocSearch-Container
|
|
87
|
+
height 100vh
|
|
88
|
+
height -webkit-fill-available
|
|
89
|
+
position absolute
|
|
90
|
+
.DocSearch-Footer
|
|
91
|
+
border-radius 0
|
|
92
|
+
bottom 0
|
|
93
|
+
position absolute
|
|
94
|
+
.DocSearch-Hit-content-wrapper
|
|
95
|
+
display flex
|
|
96
|
+
position relative
|
|
97
|
+
width 80%
|
|
98
|
+
.DocSearch-Modal
|
|
99
|
+
border-radius 0
|
|
100
|
+
box-shadow none
|
|
101
|
+
height 100vh
|
|
102
|
+
height -webkit-fill-available
|
|
103
|
+
margin 0
|
|
104
|
+
max-width 100%
|
|
105
|
+
width 100%
|
|
106
|
+
.DocSearch-Cancel
|
|
107
|
+
-webkit-appearance none
|
|
108
|
+
-moz-appearance none
|
|
109
|
+
appearance none
|
|
110
|
+
background none
|
|
111
|
+
border 0
|
|
112
|
+
color var(--docsearch-highlight-color)
|
|
113
|
+
cursor pointer
|
|
114
|
+
display inline-block
|
|
115
|
+
flex none
|
|
116
|
+
font inherit
|
|
117
|
+
font-size 1em
|
|
118
|
+
font-weight 500
|
|
119
|
+
margin-left var(--docsearch-spacing)
|
|
120
|
+
outline none
|
|
121
|
+
overflow hidden
|
|
122
|
+
padding 0
|
|
123
|
+
-webkit-user-select none
|
|
124
|
+
-moz-user-select none
|
|
125
|
+
-ms-user-select none
|
|
126
|
+
user-select none
|
|
127
|
+
white-space nowrap
|
|
128
|
+
.DocSearch-Commands,.DocSearch-Hit-Tree
|
|
129
|
+
display none
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li :class="li_class">
|
|
3
|
+
<a :href="handleUrl(item.url)">
|
|
4
|
+
<div class="DocSearch-Hit-Container">
|
|
5
|
+
<div
|
|
6
|
+
class="DocSearch-Hit-content-wrapper"
|
|
7
|
+
v-if="item.hierarchy[item.type] && item.type === 'lvl1'"
|
|
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>
|
|
12
|
+
|
|
13
|
+
<div v-else-if="isContent" class="DocSearch-Hit-content-wrapper">
|
|
14
|
+
<span class="DocSearch-Hit-title" v-html="contentHtml" />
|
|
15
|
+
<span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html || hierarchyLvl2Html" />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div v-else class="DocSearch-Hit-content-wrapper">
|
|
19
|
+
<span
|
|
20
|
+
class="DocSearch-Hit-title"
|
|
21
|
+
v-html="snippetResultContent(`hierarchy.${item.type}`)"
|
|
22
|
+
/>
|
|
23
|
+
<span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html" />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<span v-if="item.tag && item.tag !== 'uniCloud'" class="DocSearch-Hit-source_tag">
|
|
27
|
+
{{ item.tag }}
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
</a>
|
|
31
|
+
</li>
|
|
32
|
+
</template>
|
|
33
|
+
<script>
|
|
34
|
+
function getPropertyByPath(object, path) {
|
|
35
|
+
const parts = path.split('.');
|
|
36
|
+
|
|
37
|
+
return parts.reduce((prev, current) => {
|
|
38
|
+
if (prev && prev[current]) return prev[current];
|
|
39
|
+
return null;
|
|
40
|
+
}, object);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
data() {
|
|
45
|
+
return {};
|
|
46
|
+
},
|
|
47
|
+
props: {
|
|
48
|
+
item: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: () => ({}),
|
|
51
|
+
},
|
|
52
|
+
index: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 0,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
computed: {
|
|
58
|
+
li_class() {
|
|
59
|
+
return ['DocSearch-Hit', this.item.__docsearch_parent && 'DocSearch-Hit--Child']
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.join(' ');
|
|
62
|
+
},
|
|
63
|
+
isContent() {
|
|
64
|
+
return this.item.type === 'content';
|
|
65
|
+
},
|
|
66
|
+
contentHtml() {
|
|
67
|
+
return this.snippetResultContent('content');
|
|
68
|
+
},
|
|
69
|
+
hierarchyLvl1Html() {
|
|
70
|
+
return this.snippetResultContent('hierarchy.lvl1');
|
|
71
|
+
},
|
|
72
|
+
hierarchyLvl2Html() {
|
|
73
|
+
const lvl2 = this.snippetResultContent('hierarchy.lvl2');
|
|
74
|
+
return this.isContent ? this.contentHtml === lvl2 ? '' : lvl2 : '';
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
snippetResultContent(attribute) {
|
|
79
|
+
return (
|
|
80
|
+
getPropertyByPath(this.item, `_snippetResult.${attribute}.value`) ||
|
|
81
|
+
getPropertyByPath(this.item, attribute)
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
handleUrl(url) {
|
|
85
|
+
const len = url.length
|
|
86
|
+
const lastIndex = url.lastIndexOf('/')
|
|
87
|
+
if (lastIndex === len - 1) {
|
|
88
|
+
return url
|
|
89
|
+
}
|
|
90
|
+
const front = url.substring(0, lastIndex + 1)
|
|
91
|
+
const end = url.substring(lastIndex + 1)
|
|
92
|
+
if (end.indexOf('.html') > -1) {
|
|
93
|
+
return url
|
|
94
|
+
}
|
|
95
|
+
if (end.indexOf('#') > -1) {
|
|
96
|
+
return front + end.replace(/([\s\S]+)#([\s\S]+)/, '$1.html#$2')
|
|
97
|
+
}
|
|
98
|
+
return `${url}.html`
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
103
|
+
<style lang="stylus">
|
|
104
|
+
.DocSearch-Hit-source_tag {
|
|
105
|
+
background-color: #f0f0f0;
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
padding: 2px 4px;
|
|
108
|
+
color: #999;
|
|
109
|
+
border-radius: 3px;
|
|
110
|
+
margin-right: 5px;
|
|
111
|
+
font-weight: normal;
|
|
112
|
+
}
|
|
113
|
+
.DocSearch-Hit
|
|
114
|
+
border-radius 0px
|
|
115
|
+
display flex
|
|
116
|
+
padding-bottom 0px
|
|
117
|
+
position relative
|
|
118
|
+
|
|
119
|
+
&:not(:first-child)
|
|
120
|
+
border-top 1px solid #f5f6f7
|
|
121
|
+
|
|
122
|
+
a
|
|
123
|
+
background var(--docsearch-hit-background)
|
|
124
|
+
border-radius 0px
|
|
125
|
+
// box-shadow var(--docsearch-hit-shadow)
|
|
126
|
+
box-shadow none
|
|
127
|
+
display block
|
|
128
|
+
padding-left var(--docsearch-spacing)
|
|
129
|
+
width 100%
|
|
130
|
+
|
|
131
|
+
.DocSearch-Hit-Container
|
|
132
|
+
align-items center
|
|
133
|
+
color #444950
|
|
134
|
+
display flex
|
|
135
|
+
flex-direction row
|
|
136
|
+
height 56px
|
|
137
|
+
padding 0 12px 0 0
|
|
138
|
+
|
|
139
|
+
.DocSearch-Hit-content-wrapper
|
|
140
|
+
overflow hidden
|
|
141
|
+
display flex
|
|
142
|
+
flex 1 1 auto
|
|
143
|
+
flex-direction column
|
|
144
|
+
font-weight 500
|
|
145
|
+
justify-content center
|
|
146
|
+
line-height 1.2em
|
|
147
|
+
margin 0 8px
|
|
148
|
+
overflow-x hidden
|
|
149
|
+
position relative
|
|
150
|
+
text-overflow ellipsis
|
|
151
|
+
white-space nowrap
|
|
152
|
+
width 80%
|
|
153
|
+
|
|
154
|
+
.DocSearch-Hit-title
|
|
155
|
+
font-size 0.9em
|
|
156
|
+
|
|
157
|
+
.DocSearch-Hit-path
|
|
158
|
+
// color $accentColor
|
|
159
|
+
font-size 0.75em
|
|
160
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="DocSearch-Hits">
|
|
3
|
+
<div class="DocSearch-Hit-source">
|
|
4
|
+
{{ title }}
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<ul id="docsearch-list">
|
|
8
|
+
<template v-for="(item, index) in results">
|
|
9
|
+
<Result
|
|
10
|
+
:key="[title, item.objectID].join(':')"
|
|
11
|
+
:item="item"
|
|
12
|
+
:index="index"
|
|
13
|
+
@click.native="event => onSelect({ item, event })"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
</ul>
|
|
17
|
+
</section>
|
|
18
|
+
</template>
|
|
19
|
+
<script>
|
|
20
|
+
import Result from './Result.vue';
|
|
21
|
+
export default {
|
|
22
|
+
components: { Result },
|
|
23
|
+
data() {
|
|
24
|
+
return {};
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
title: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: '文档',
|
|
30
|
+
},
|
|
31
|
+
results: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: [],
|
|
34
|
+
},
|
|
35
|
+
onSelect: {
|
|
36
|
+
type: Function,
|
|
37
|
+
default: () => {},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
computed: {
|
|
41
|
+
tag() {
|
|
42
|
+
return this.results[0].tag !== 'uniCloud' ? this.results[0].tag : '';
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
<style lang="stylus">
|
|
48
|
+
#docsearch-list{
|
|
49
|
+
border-radius: 5px;
|
|
50
|
+
padding: 0;
|
|
51
|
+
border: 1px solid #dfe2e5;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.DocSearch-Hits mark {
|
|
56
|
+
background: none;
|
|
57
|
+
color: $accentColor;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.DocSearch-Hit-source {
|
|
61
|
+
background-color $search-container-color;
|
|
62
|
+
color: $accentColor;
|
|
63
|
+
font-size 1em;
|
|
64
|
+
padding 15px 4px 15px
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 分页结构 -->
|
|
3
|
+
<div class="page-bar">
|
|
4
|
+
<ul>
|
|
5
|
+
<li v-if="cur > 1"><a class="clearfix" v-on:click="cur--, pageClick()">上一页</a></li>
|
|
6
|
+
<li v-if="cur == 1"><a class="banclick clearfix">上一页</a></li>
|
|
7
|
+
<template v-for="index in indexs">
|
|
8
|
+
<li :key="index" :class="{ active: cur == index }">
|
|
9
|
+
<a class="clearfix" v-on:click="btnClick(index)">{{ index }}</a>
|
|
10
|
+
</li>
|
|
11
|
+
</template>
|
|
12
|
+
<li v-if="cur != all"><a class="clearfix" v-on:click="cur++, pageClick()">下一页</a></li>
|
|
13
|
+
<li v-if="cur == all"><a class="banclick clearfix">下一页</a></li>
|
|
14
|
+
<li>
|
|
15
|
+
<span>
|
|
16
|
+
共
|
|
17
|
+
<i>{{ all }}</i>
|
|
18
|
+
页
|
|
19
|
+
</span>
|
|
20
|
+
</li>
|
|
21
|
+
</ul>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<script>
|
|
25
|
+
export default {
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
all: 10, //总页数
|
|
29
|
+
cur: 1, //当前页码
|
|
30
|
+
// totalPage: 0, //当前条数
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
curPage: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 1,
|
|
37
|
+
},
|
|
38
|
+
totalPage: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 0,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
created() {
|
|
44
|
+
this.all = this.totalPage;
|
|
45
|
+
this.cur = this.curPage;
|
|
46
|
+
},
|
|
47
|
+
watch: {
|
|
48
|
+
curPage: {
|
|
49
|
+
immediate: true,
|
|
50
|
+
handler(val) {
|
|
51
|
+
this.cur = val;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
totalPage: {
|
|
55
|
+
immediate: true,
|
|
56
|
+
handler(val) {
|
|
57
|
+
this.all = val;
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
//请求数据
|
|
63
|
+
dataListFn: function (index) {
|
|
64
|
+
this.$emit('research', index);
|
|
65
|
+
},
|
|
66
|
+
//分页
|
|
67
|
+
btnClick: function (data) {
|
|
68
|
+
if (data != this.cur) {
|
|
69
|
+
this.cur = data;
|
|
70
|
+
this.dataListFn(this.cur);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
pageClick: function () {
|
|
74
|
+
this.dataListFn(this.cur);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
//分页
|
|
79
|
+
indexs: function () {
|
|
80
|
+
var left = 1;
|
|
81
|
+
var right = this.all;
|
|
82
|
+
var ar = [];
|
|
83
|
+
if (this.all >= 5) {
|
|
84
|
+
if (this.cur > 3 && this.cur < this.all - 2) {
|
|
85
|
+
left = this.cur - 2;
|
|
86
|
+
right = this.cur + 2;
|
|
87
|
+
} else {
|
|
88
|
+
if (this.cur <= 3) {
|
|
89
|
+
left = 1;
|
|
90
|
+
right = 5;
|
|
91
|
+
} else {
|
|
92
|
+
right = this.all;
|
|
93
|
+
left = this.all - 4;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
while (left <= right) {
|
|
98
|
+
ar.push(left);
|
|
99
|
+
left++;
|
|
100
|
+
}
|
|
101
|
+
return ar;
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
<style lang="stylus" scoped>
|
|
107
|
+
.page-bar
|
|
108
|
+
display flex
|
|
109
|
+
justify-content center
|
|
110
|
+
margin 10px
|
|
111
|
+
|
|
112
|
+
ul, li
|
|
113
|
+
margin 0px
|
|
114
|
+
padding 0px
|
|
115
|
+
user-select none
|
|
116
|
+
|
|
117
|
+
li
|
|
118
|
+
display inline-block
|
|
119
|
+
list-style none
|
|
120
|
+
overflow hidden
|
|
121
|
+
|
|
122
|
+
.page-bar li:first-child > a
|
|
123
|
+
margin-left 0px
|
|
124
|
+
|
|
125
|
+
.page-bar a
|
|
126
|
+
border 1px solid #ddd
|
|
127
|
+
text-decoration none
|
|
128
|
+
position relative
|
|
129
|
+
float left
|
|
130
|
+
padding 2px 10px
|
|
131
|
+
margin-left -1px
|
|
132
|
+
line-height 1.42857143
|
|
133
|
+
color #5d6062
|
|
134
|
+
cursor pointer
|
|
135
|
+
margin-right 20px
|
|
136
|
+
background-color #fff
|
|
137
|
+
|
|
138
|
+
.page-bar a:hover
|
|
139
|
+
background-color #eee
|
|
140
|
+
|
|
141
|
+
.page-bar a.banclick
|
|
142
|
+
cursor not-allowed
|
|
143
|
+
|
|
144
|
+
.page-bar .active a
|
|
145
|
+
color #fff
|
|
146
|
+
cursor default
|
|
147
|
+
background-color $accentColor
|
|
148
|
+
border-color $accentColor
|
|
149
|
+
|
|
150
|
+
.page-bar i
|
|
151
|
+
font-style normal
|
|
152
|
+
color $accentColor
|
|
153
|
+
margin 0px 4px
|
|
154
|
+
font-size 12px
|
|
155
|
+
</style>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
$svg-color = #b1b2b3
|
|
2
|
+
$svg-hover-color = #9b9b9b
|
|
3
|
+
|
|
4
|
+
@import './styles/ext.styl'
|
|
5
|
+
@import './styles/ask.styl'
|
|
6
|
+
|
|
7
|
+
#search-container
|
|
8
|
+
position relative
|
|
9
|
+
overflow auto
|
|
10
|
+
position fixed
|
|
11
|
+
width 100%
|
|
12
|
+
height 100%
|
|
13
|
+
left 0
|
|
14
|
+
top 0
|
|
15
|
+
z-index 200
|
|
16
|
+
background-color $search-container-color
|
|
17
|
+
|
|
18
|
+
.sub-navbar, .result-wrap
|
|
19
|
+
margin 0 auto
|
|
20
|
+
|
|
21
|
+
.search-wrap
|
|
22
|
+
width 100%
|
|
23
|
+
vertical-align middle
|
|
24
|
+
position relative
|
|
25
|
+
display flex
|
|
26
|
+
flex-direction column
|
|
27
|
+
align-items center
|
|
28
|
+
|
|
29
|
+
.input-wrap
|
|
30
|
+
width 80%
|
|
31
|
+
max-width 960px
|
|
32
|
+
margin-top 24px
|
|
33
|
+
position relative
|
|
34
|
+
display flex
|
|
35
|
+
align-items center
|
|
36
|
+
box-sizing border-box
|
|
37
|
+
|
|
38
|
+
.search-input-btn
|
|
39
|
+
display flex
|
|
40
|
+
flex-direction column
|
|
41
|
+
justify-content center
|
|
42
|
+
padding 0
|
|
43
|
+
font-size 0
|
|
44
|
+
background-color #fff
|
|
45
|
+
|
|
46
|
+
button
|
|
47
|
+
width 40px
|
|
48
|
+
font-family inherit
|
|
49
|
+
font-size 100%
|
|
50
|
+
margin 0
|
|
51
|
+
outline 0
|
|
52
|
+
background-color transparent
|
|
53
|
+
padding 0
|
|
54
|
+
border-width 0
|
|
55
|
+
vertical-align middle
|
|
56
|
+
cursor pointer
|
|
57
|
+
|
|
58
|
+
svg
|
|
59
|
+
fill $svg-color
|
|
60
|
+
|
|
61
|
+
&:hover
|
|
62
|
+
fill $svg-hover-color
|
|
63
|
+
|
|
64
|
+
.search-input
|
|
65
|
+
width 100%
|
|
66
|
+
height 56px
|
|
67
|
+
font-size 16px
|
|
68
|
+
border none
|
|
69
|
+
box-sizing border-box
|
|
70
|
+
outline none
|
|
71
|
+
padding 1px 18px
|
|
72
|
+
border-radius 4px
|
|
73
|
+
|
|
74
|
+
.search-input-btn
|
|
75
|
+
height 56px
|
|
76
|
+
|
|
77
|
+
.search-back__btn
|
|
78
|
+
display block !important
|
|
79
|
+
font-size 17px
|
|
80
|
+
color #576b95
|
|
81
|
+
line-height 24px
|
|
82
|
+
padding 10px 16px
|
|
83
|
+
white-space nowrap
|
|
84
|
+
/* position absolute
|
|
85
|
+
right -65px */
|
|
86
|
+
|
|
87
|
+
.search-category
|
|
88
|
+
width 100%
|
|
89
|
+
|
|
90
|
+
.navbar
|
|
91
|
+
border none
|
|
92
|
+
|
|
93
|
+
.main-navbar
|
|
94
|
+
box-shadow none
|
|
95
|
+
|
|
96
|
+
.main-navbar-links
|
|
97
|
+
width 90%
|
|
98
|
+
padding 0
|
|
99
|
+
display flex
|
|
100
|
+
justify-content center
|
|
101
|
+
flex-wrap wrap
|
|
102
|
+
|
|
103
|
+
@media (max-width 630px)
|
|
104
|
+
&
|
|
105
|
+
white-space normal !important
|
|
106
|
+
|
|
107
|
+
.main-navbar-item
|
|
108
|
+
padding 0 2%
|
|
109
|
+
|
|
110
|
+
@media (max-width 900px)
|
|
111
|
+
&
|
|
112
|
+
padding 0 1%
|
|
113
|
+
|
|
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
|
+
|
|
157
|
+
@media (max-width $MQMobile)
|
|
158
|
+
#search-container
|
|
159
|
+
.search-navbar-header>.main-navbar
|
|
160
|
+
display none !important
|
|
161
|
+
|
|
162
|
+
.main-navbar
|
|
163
|
+
justify-content center
|
|
164
|
+
|
|
165
|
+
.search-navbar>.navbar, .search-category>.navbar
|
|
166
|
+
line-height 3rem
|
|
167
|
+
height auto
|
|
168
|
+
position static !important
|
|
169
|
+
|
|
170
|
+
.input-wrap
|
|
171
|
+
width 100% !important
|
|
172
|
+
padding-left 5px
|
|
173
|
+
margin-top 5px !important
|
|
174
|
+
|
|
175
|
+
.search-input, .search-input-btn
|
|
176
|
+
height 32px !important
|
|
177
|
+
|
|
178
|
+
.search-result
|
|
179
|
+
width 100% !important
|
|
180
|
+
padding 0 10px
|
|
181
|
+
|
|
182
|
+
.search-result-aside
|
|
183
|
+
display none
|