mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
[improvement] update eslint config (#2288)
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
*/
|
||||
|
||||
import { setLang } from './lang';
|
||||
import { iframeReady, isMobile } from './';
|
||||
import { iframeReady, isMobile } from '.';
|
||||
|
||||
window.syncPath = function(dir) {
|
||||
window.syncPath = function () {
|
||||
const router = window.vueRouter;
|
||||
const isInIframe = window !== window.top;
|
||||
const currentDir = router.history.current.path;
|
||||
@@ -28,7 +28,7 @@ window.syncPath = function(dir) {
|
||||
}
|
||||
};
|
||||
|
||||
window.changePath = function(lang, path = '') {
|
||||
window.changePath = function (lang, path = '') {
|
||||
setLang(lang);
|
||||
window.vueRouter.replace(path);
|
||||
};
|
||||
|
@@ -14,11 +14,9 @@ const langMap = {
|
||||
};
|
||||
let currentLang = '';
|
||||
|
||||
setLang(getDefaultLang());
|
||||
|
||||
function getDefaultLang() {
|
||||
const langs = Object.keys(langMap);
|
||||
const hash = location.hash;
|
||||
const { hash } = location;
|
||||
|
||||
for (let i = 0; i < langs.length; i++) {
|
||||
if (hash.indexOf(langs[i]) !== -1) {
|
||||
@@ -42,3 +40,5 @@ export function setLang(lang) {
|
||||
Locale.use(lang, langMap[lang].messages);
|
||||
document.title = langMap[lang].title;
|
||||
}
|
||||
|
||||
setLang(getDefaultLang());
|
||||
|
Reference in New Issue
Block a user