[Doc] update demo

This commit is contained in:
陈嘉涵
2019-05-29 11:23:10 +08:00
parent 3bc5a93941
commit 764cad3393
12 changed files with 61 additions and 156 deletions

View File

@@ -6,15 +6,8 @@ export default {
$t() {
const { name } = this.$options;
const prefix = name ? camelize(name) + '.' : '';
if (!this.$vantMessages) {
if (process.env.NODE_ENV !== 'production') {
console.error('[Vant] Locale not correctly registered');
}
return () => '';
}
const messages = this.$vantMessages[this.$vantLang];
return (path, ...args) => {
const message = get(messages, prefix + path) || get(messages, path);
return typeof message === 'function' ? message(...args) : message;

View File

@@ -20,7 +20,14 @@ function iframeReady(iframe, callback) {
const ua = navigator.userAgent.toLowerCase();
const isMobile = /ios|iphone|ipod|ipad|android/.test(ua);
function importAll(map, r) {
r.keys().forEach(key => {
map[key] = r(key);
});
}
export {
isMobile,
importAll,
iframeReady
};

View File

@@ -12,6 +12,7 @@ const langMap = {
messages: zhCN
}
};
let currentLang = '';
function getDefaultLang() {