vuepress-theme-uniapp-official 1.6.21 → 1.6.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # vuepress-theme-uniapp-official
2
2
 
3
+ ## 1.6.22
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: 优化 navbar 结构; 多语言配置可为空
8
+ - feat: repo config
9
+
3
10
  ## 1.6.21
4
11
 
5
12
  ### Patch Changes
@@ -18,18 +18,6 @@
18
18
  :item="item"
19
19
  />
20
20
  </div>
21
-
22
- <!-- repo link -->
23
- <!-- <a
24
- v-if="repoLink"
25
- :href="repoLink"
26
- class="repo-link"
27
- target="_blank"
28
- rel="noopener noreferrer"
29
- >
30
- {{ repoLabel }}
31
- <OutboundLink />
32
- </a> -->
33
21
  </nav>
34
22
  </template>
35
23
 
@@ -93,34 +81,6 @@ export default {
93
81
  items: (link.items || []).map(resolveNavLinkItem)
94
82
  })
95
83
  })
96
- },
97
-
98
- repoLink () {
99
- const { repo } = this.$site.themeConfig
100
- if (repo) {
101
- return /^https?:/.test(repo)
102
- ? repo
103
- : `https://github.com/${repo}`
104
- }
105
- return null
106
- },
107
-
108
- repoLabel () {
109
- if (!this.repoLink) return
110
- if (this.$site.themeConfig.repoLabel) {
111
- return this.$site.themeConfig.repoLabel
112
- }
113
-
114
- const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0]
115
- const platforms = ['GitHub', 'GitLab', 'Bitbucket']
116
- for (let i = 0; i < platforms.length; i++) {
117
- const platform = platforms[i]
118
- if (new RegExp(platform, 'i').test(repoHost)) {
119
- return platform
120
- }
121
- }
122
-
123
- return 'Source'
124
84
  }
125
85
  }
126
86
  }
@@ -28,36 +28,54 @@
28
28
  </div>
29
29
  </div>
30
30
 
31
- <div class="dropdown-language" @click="switchLanguage">
32
- <div style="display: flex;align-items: center;">
33
- <span>{{navbarLanguage[navConfig.languageIndex].text}}</span>
34
- <svg t="1629441415944" viewBox="0 20 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3713"
35
- width="16" height="16" class="icon">
36
- <path
37
- d="M508.025406 655.446718c-14.45307 0-28.183486-5.781228-39.023289-15.898376l-231.249118-231.249118c-10.117149-10.117149-10.117149-26.015526 0-36.132675s26.015526-10.117149 36.132675 0l231.249118 231.249118c2.16796 2.16796 4.335921 2.16796 5.781228 0l231.971771-231.971771c10.117149-10.117149 26.015526-10.117149 35.410021 0 10.117149 10.117149 10.117149 26.015526 0 36.132674l-231.971771 231.971772c-9.394495 10.117149-23.124912 15.898377-38.300635 15.898376z"
38
- p-id="3714"></path>
39
- </svg>
31
+ <div class="main-navbar_right">
32
+
33
+ <div class="links" :style="{ top: `${this.SearchBoxTop}px` }">
34
+ <!-- <a class="switch-version" href="javascript:void(0)">回到旧版</a> -->
35
+ <DcloudSearchPage v-if="isAlgoliaSearch" ref="dcloudSearchPage" :options="algolia" />
36
+ <AlgoliaSearchBox v-if="isAlgoliaSearch" />
37
+ <SearchBox v-else-if="$site.themeConfig.search !== false && $page.frontmatter.search !== false" />
40
38
  </div>
41
- <div v-if="showLanguage" class="dropdown-content">
42
- <div
43
- v-for="(item,index) in navbarLanguage"
44
- :key="item.link"
45
- @click="() => { typeof item.click === 'function' && item.click(index === navConfig.languageIndex) }"
46
- >
47
- <a :href="index === navConfig.languageIndex ? 'javascript:;' : item.link" target="_self" :key="item.text"
48
- :class="[index === navConfig.languageIndex ? 'clickDisabled' : '']">
49
- {{item.text}}
50
- </a>
39
+
40
+ <div v-if="navbarLanguage" class="dropdown-language" @click="switchLanguage">
41
+ <div style="display: flex;align-items: center;">
42
+ <span>{{navbarLanguage[navConfig.languageIndex].text}}</span>
43
+ <svg t="1629441415944" viewBox="0 20 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3713"
44
+ width="16" height="16" class="icon">
45
+ <path
46
+ d="M508.025406 655.446718c-14.45307 0-28.183486-5.781228-39.023289-15.898376l-231.249118-231.249118c-10.117149-10.117149-10.117149-26.015526 0-36.132675s26.015526-10.117149 36.132675 0l231.249118 231.249118c2.16796 2.16796 4.335921 2.16796 5.781228 0l231.971771-231.971771c10.117149-10.117149 26.015526-10.117149 35.410021 0 10.117149 10.117149 10.117149 26.015526 0 36.132674l-231.971771 231.971772c-9.394495 10.117149-23.124912 15.898377-38.300635 15.898376z"
47
+ p-id="3714"></path>
48
+ </svg>
49
+ </div>
50
+ <div v-if="showLanguage" class="dropdown-content">
51
+ <div
52
+ v-for="(item,index) in navbarLanguage"
53
+ :key="item.link"
54
+ @click="() => { typeof item.click === 'function' && item.click(index === navConfig.languageIndex) }"
55
+ >
56
+ <a :href="index === navConfig.languageIndex ? 'javascript:;' : item.link" target="_self" :key="item.text"
57
+ :class="[index === navConfig.languageIndex ? 'clickDisabled' : '']">
58
+ {{item.text}}
59
+ </a>
60
+ </div>
51
61
  </div>
52
62
  </div>
53
- </div>
54
63
 
55
- <div class="links" :style="{ top: `${this.SearchBoxTop}px` }">
56
- <!-- <a class="switch-version" href="javascript:void(0)">回到旧版</a> -->
57
- <DcloudSearchPage v-if="isAlgoliaSearch" ref="dcloudSearchPage" :options="algolia" />
58
- <AlgoliaSearchBox v-if="isAlgoliaSearch" />
59
- <SearchBox v-else-if="$site.themeConfig.search !== false && $page.frontmatter.search !== false" />
64
+ <!-- repo link -->
65
+ <a
66
+ v-if="repoLink"
67
+ :href="repoLink"
68
+ class="repo-link"
69
+ style="color: black"
70
+ target="_blank"
71
+ rel="noopener noreferrer"
72
+ >
73
+ {{ repoLabel }}
74
+ <OutboundLink />
75
+ </a>
76
+
60
77
  </div>
78
+
61
79
  </div>
62
80
 
63
81
  <div class="sub-navbar">
@@ -119,6 +137,34 @@ export default {
119
137
 
120
138
  isAlgoliaSearch () {
121
139
  return this.algolia && this.algolia.apiKey && this.algolia.indexName
140
+ },
141
+
142
+ repoLink () {
143
+ const { repo } = this.$site.themeConfig
144
+ if (repo) {
145
+ return /^https?:/.test(repo)
146
+ ? repo
147
+ : `https://github.com/${repo}`
148
+ }
149
+ return null
150
+ },
151
+
152
+ repoLabel () {
153
+ if (!this.repoLink) return
154
+ if (this.$site.themeConfig.repoLabel) {
155
+ return this.$site.themeConfig.repoLabel
156
+ }
157
+
158
+ const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0]
159
+ const platforms = ['GitHub', 'GitLab', 'GitCode', 'Gitee', 'Bitbucket']
160
+ for (let i = 0; i < platforms.length; i++) {
161
+ const platform = platforms[i]
162
+ if (new RegExp(platform, 'i').test(repoHost)) {
163
+ return platform
164
+ }
165
+ }
166
+
167
+ return 'Source'
122
168
  }
123
169
  },
124
170
 
@@ -264,10 +310,6 @@ $navbar-horizontal-padding = 1.5rem
264
310
  // background-color white
265
311
  white-space nowrap
266
312
  font-size 0.9rem
267
- position absolute
268
- right $navbar-horizontal-padding
269
- top 0 //$navbar-vertical-padding
270
- transition: top 0.1s ease 0s
271
313
  display flex
272
314
  .search-box
273
315
  flex: 0 0 auto
@@ -280,7 +322,6 @@ $navbar-horizontal-padding = 1.5rem
280
322
  display none !important
281
323
  .links
282
324
  padding-left 0rem // 1.5rem
283
- top 0 !important
284
325
  .site-name
285
326
  width calc(100vw - 9.4rem)
286
327
  overflow hidden
@@ -2,7 +2,7 @@ import { navbar, navbarLanguage, userNavIndex } from '@theme-config/navbar';
2
2
 
3
3
  export default {
4
4
  data() {
5
- return { navConfig: { userNavIndex: userNavIndex || 0, languageIndex: navbarLanguage.default } }
5
+ return { navConfig: { userNavIndex: userNavIndex || 0, languageIndex: (navbarLanguage || {}).default } }
6
6
  },
7
7
 
8
8
  provide() {
@@ -12,7 +12,7 @@ export default {
12
12
  changeUserNav: this.changeUserNav,
13
13
  customNavBarKeys: this.customNavBarKeys,
14
14
  customNavBarLinks: this.customNavBarLinks,
15
- navbarLanguage: navbarLanguage.items
15
+ navbarLanguage: (navbarLanguage || {}).items
16
16
  }
17
17
  },
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuepress-theme-uniapp-official",
3
- "version": "1.6.21",
3
+ "version": "1.6.22",
4
4
  "description": "uni-app official website theme for vuepress",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -47,9 +47,9 @@
47
47
  "vuepress-plugin-mermaidjs": "1.9.1",
48
48
  "vuepress-plugin-named-chunks": "^1.1.4",
49
49
  "vuepress-plugin-zooming": "^1.1.8",
50
- "vuepress-plugin-noscript-code": "^1.0.2",
51
50
  "vuepress-plugin-check-md2": "^1.0.5",
52
- "vuepress-plugin-expandable-row": "^1.0.10"
51
+ "vuepress-plugin-expandable-row": "^1.0.10",
52
+ "vuepress-plugin-noscript-code": "^1.0.2"
53
53
  },
54
54
  "resolutions": {
55
55
  "terser-webpack-plugin": "1.4.6",
@@ -94,13 +94,17 @@ $navbar-logo-height = $navbar-main-navbar-height - 2rem
94
94
  span
95
95
  font-size 16px
96
96
 
97
+ .main-navbar_right
98
+ display flex
99
+ justify-content: center
100
+ align-items: center
101
+ position absolute
102
+ right $navbar-horizontal-padding
103
+ & > div:not(:last-child)
104
+ padding-right 5px
97
105
  .dropdown-language
106
+ position relative
98
107
  user-select none
99
- position absolute
100
- right 10rem
101
- @media (max-width: $DocSearch_MQMobile)
102
- &
103
- right 4.5rem
104
108
  &>div:nth-child(1)
105
109
  cursor pointer
106
110
  svg
@@ -143,7 +147,7 @@ $navbar-logo-height = $navbar-main-navbar-height - 2rem
143
147
  justify-content flex-end
144
148
  .mobile-main-navbar
145
149
  display inline-block
146
- padding-right 170px
150
+ padding-right 230px
147
151
  a
148
152
  color $navbar-a-color
149
153
  .mobile-links__btn:after
@@ -7,5 +7,5 @@ $navbar-background-color = #f7f7f7
7
7
  $search-container-color = #f5f6f7
8
8
  $vuepress-toc-width = 14rem
9
9
  $vuepress-display-min-width = 1500px
10
- $MQMobile = 1050px
10
+ $MQMobile = 1140px
11
11
  $DocSearch_MQMobile = 1400px