From 865fb4f8fa185290d5c34982b8d33fdf38cb69fa Mon Sep 17 00:00:00 2001 From: nicejade Date: Thu, 3 May 2018 22:50:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20lang=20property=20for=20html=20el?= =?UTF-8?q?ement=20=F0=9F=98=8A=20=20#24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ejs | 4 ++-- src/mixins/globalMixin.js | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.ejs b/index.ejs index 35feea7d..2053150a 100644 --- a/index.ejs +++ b/index.ejs @@ -1,12 +1,12 @@ - + 倾城之链 | NICE LINKS - + diff --git a/src/mixins/globalMixin.js b/src/mixins/globalMixin.js index 78e0cd77..d64bb487 100644 --- a/src/mixins/globalMixin.js +++ b/src/mixins/globalMixin.js @@ -40,9 +40,12 @@ Vue.mixin({ }, $switchLang () { - let currentLang = Vue.config.lang === 'zh' ? 'en' : 'zh' + const currentLang = Vue.config.lang === 'zh' ? 'en' : 'zh' Vue.config.lang = currentLang Cookies.set('lang', currentLang) + + const htmlLang = currentLang === 'zh' ? 'zh-CN' : 'en' + document.getElementsByTagName('html')[0].lang = htmlLang }, $switchRouteByExplore (name = '') {