element-ui国际化

  <!--let value = i18nHandler.apply(this, arguments);-->
  <!--if (value !== null && value !== undefined) return value;-->

  const array = path.split('.');
  let current = lang;

  for (let i = 0, j = array.length; i < j; i++) {
    const property = array[i];
    value = current[property];
    if (i === j - 1) return format(value, options);
    if (!value) return '';
    current = value;
  }
  return '';
};

可以把取得如下对象的值 t('el.colorpicker.confirm')

   colorpicker: {
     confirm: '确定',
     clear: '清空'
   },
   ...
}

评论

暂无评论