Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: add lang property for html element 😊 #24
  • Loading branch information
nicejade committed May 3, 2018
1 parent 58430fd commit 865fb4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.ejs
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>倾城之链 | NICE LINKS</title>
<meta name="viewport" content="user-scalable=yes,width=device-width,initial-scale=1,maximum-scale=3">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@jeffjade2" />
<meta name="twitter:site" content="@nicejadeyang" />
<meta name="twitter:title" content="倾城之链 | NICE LINKS" />
<meta name="twitter:description" content="倾城之链,作为一个开放平台,旨在云集全球优秀网站,探索互联网中更广阔的世界;在这里,你可以轻松发现、学习、分享更多有用或有趣的事物。" />
<meta name="twitter:image" content="https://static.nicelinks.site/static/img/favicons/favicon.png" />
Expand Down
5 changes: 4 additions & 1 deletion src/mixins/globalMixin.js
Expand Up @@ -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 = '') {
Expand Down

0 comments on commit 865fb4f

Please sign in to comment.