This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-handbook.git
The following commit(s) were added to refs/heads/master by this push:
new a8432c9 fix: move head config to layouts/default.vue
a8432c9 is described below
commit a8432c9fb0d64de770d98bd4dccb6a9ffd73e01a
Author: plainheart <[email protected]>
AuthorDate: Sat Dec 9 06:28:41 2023 +0800
fix: move head config to layouts/default.vue
---
layouts/default.vue | 69 ++++++++++++++++++++++++++++++++++++++++++++++-------
nuxt.config.js | 49 +------------------------------------
2 files changed, 61 insertions(+), 57 deletions(-)
diff --git a/layouts/default.vue b/layouts/default.vue
index a9d5c07..ee8f289 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -28,20 +28,71 @@ export default {
Navbar
},
+ head() {
+ const locale = (this as any).$i18n.locale;
+ const isCN = locale === 'zh';
+ const appName = isCN ? '使用手册' : 'Handbook'
+ return {
+ titleTemplate: chunk => `${chunk ? chunk + ' - ' : ''}${appName} -
Apache ECharts`,
+ htmlAttrs: {
+ lang: isCN ? 'zh-CN' : 'en'
+ },
+ link: [
+ {
+ rel: 'shortcut icon',
+ type: 'image/png',
+ href: `https://echarts.apache.org/${locale}/images/favicon.png`
+ },
+ {
+ rel: 'stylesheet',
+ href: isCN
+ ?
'https://lib.baomitu.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css'
+ :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'
+ },
+ {
+ rel: 'stylesheet',
+ href: `https://echarts.apache.org/${locale}/css/main.css`
+ },
+ {
+ rel: 'stylesheet',
+ href: isCN
+ ? 'https://lib.baomitu.com/docsearch.js/2.6.3/docsearch.min.css'
+ :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.css'
+ }
+ ],
+ script: [
+ {
+ src: isCN
+ ? 'https://cdn.staticfile.org/jquery/3.7.1/jquery.min.js'
+ : 'https://fastly.jsdelivr.net/npm/[email protected]/dist/jquery.min.js'
+ },
+ {
+ src: isCN
+ ?
'https://lib.baomitu.com/twitter-bootstrap/3.4.1/js/bootstrap.min.js'
+ :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js'
+ },
+ {
+ src: isCN
+ ? 'https://lib.baomitu.com/docsearch.js/2.6.3/docsearch.min.js'
+ :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.js'
+ }
+ ],
+ noscript: [
+ {
+ body: true,
+ innerHTML: '<div class="no-script"><strong>很抱歉,Apache ECharts 网站需要启用
JavaScript 才能正常运行。</strong></div>'
+ }
+ ],
+ __dangerouslyDisableSanitizers: ['noscript']
+ }
+ },
+
mounted() {
// This help scroll to the hash
const hash = location.hash
location.hash = ''
location.hash = hash
- },
-
- computed: {
- // posts(): string {
- // return this.$store.state.posts.zh
- // }
- },
-
- methods: {}
+ }
}
</script>
diff --git a/nuxt.config.js b/nuxt.config.js
index f679c5d..d299642 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -41,54 +41,7 @@ export default {
/*
** Headers of the page
*/
- head() {
- const locale = this.$i18n.locale;
- const isCN = locale === 'zh';
- const appName = isCN ? '使用手册' : 'Handbook'
- return {
- titleTemplate: chunk => `${chunk ? chunk + ' - ' : ''}${appName} -
Apache ECharts`,
- link: [
- {
- rel: 'shortcut icon',
- type: 'image/png',
- href: `https://echarts.apache.org/${locale}/images/favicon.png`
- },
- {
- rel: 'stylesheet',
- href: isCN
- ?
'https://lib.baomitu.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css'
- :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'
- },
- {
- rel: 'stylesheet',
- href: `https://echarts.apache.org/${locale}/css/main.css`
- },
- {
- rel: 'stylesheet',
- href: isCN
- ? 'https://lib.baomitu.com/docsearch.js/2.6.3/docsearch.min.css'
- :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.css'
- }
- ],
- script: [
- {
- src: isCN
- ? 'https://cdn.staticfile.org/jquery/3.7.1/jquery.min.js'
- : 'https://fastly.jsdelivr.net/npm/[email protected]/dist/jquery.min.js'
- },
- {
- src: isCN
- ?
'https://lib.baomitu.com/twitter-bootstrap/3.4.1/js/bootstrap.min.js'
- :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js'
- },
- {
- src: isCN
- ? 'https://lib.baomitu.com/docsearch.js/2.6.3/docsearch.min.js'
- :
'https://fastly.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.js'
- }
- ]
- }
- },
+ head: {},
tailwindcss: {},
/*
** Customize the progress-bar color
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]