1.0.13 • Published 5 years ago
@ali-i18n-fe/mcms-helper v1.0.13
mcms-helper
MCMS Provider 美杜莎异步加载 Provider
- 支持异步加载美杜莎 CDN 数据
 - 支持多语言 Provider
 - 支持兜底文案显示,异步加载后替换
 - 支持装饰器模式
 - 支持变量替换
 
Usage
import { McmsDecorator, LOCAL_TYPE } from '@alife/mcms-helper';
import { Component } from 'react';
@McmsDecorator({
  appName: 'intl-components',
  tag: 'xxxxx',
  version: '0.0.3',
  default: { text: 'Hello' },
})
class MultipleLangInput extends Component {
  static contextTypes = {
    locale: LOCAL_TYPE,
  };
  get locale() {
    return Object.assign(this.context.locale, this.props.locale);
  }
  render() {
    return this.locale.text;
  }
}
// or
@McmsDecorator({
  appName: 'intl-components',
  tag: 'xxxxx',
  version: '0.0.3',
  default: { text: 'Hello' },
})
class MultipleLangInput extends Component {
  render() {
    return <FormattedMessage id="text" />;
  }
}Development
install
yarnstart project
yarn startbuild npm package
yarn babelbuild umd package
yarn build1.0.13
5 years ago