mip-timeago 组件

用于将指定时间转换为 * time ago 的形式,例如,3天前,2月前,31年后,5 years ago

标题 内容
类型 通用
支持布局 responsive, fixed-height, fill, container, fixed
所需脚本 https://c.mipcdn.com/static/v2/mip-timeago/mip-timeago.js

示例

  1. <mip-timeago datetime="1539477453809"></mip-timeago>
  2. <mip-timeago datetime="1519628552201" locale="zhCN"></mip-timeago>
  3. <mip-timeago datetime="1519628552201" locale="ja"></mip-timeago>
  4. <mip-timeago datetime="1519628552201" locale="ko"></mip-timeago>
  5. <mip-timeago datetime="1519628552201" locale="en" cutoff="3600">2018-2-26</mip-timeago>

查看例子编辑示例

属性

datetime (必须)

需要转换的目标时间,时间戳(ms),如 1539477453809

locale (可选)

显示语言,默认中文,值为 zhCN,可以指定如下语言:

  • ar (Arabic)
  • be (Belarusian)
  • bg (Bulgarian)
  • ca (Catalan)
  • da (Danish)
  • de (German)
  • el (Greek)
  • en (English)
  • enShort (English - short)
  • es (Spanish)
  • eu (Basque)
  • fi (Finnish)
  • fr (French)
  • he (Hebrew)
  • hu (Hungarian)
  • inBG (Bangla)
  • inHI (Hindi)
  • inID (Malay)
  • it (Italian)
  • ja (Japanese)
  • ko (Korean)
  • ml (Malayalam)
  • nbNO (Norwegian Bokmål)
  • nl (Dutch)
  • nnNO (Norwegian Nynorsk)
  • pl (Polish)
  • ptBR (Portuguese)
  • ro (Romanian)
  • ru (Russian)
  • sv (Swedish)
  • ta (Tamil)
  • th (Thai)
  • tr (Turkish)
  • uk (Ukrainian)
  • vi (Vietnamese)
  • zhCN (Chinese)
  • zhTW (Taiwanese)

cutoff (可选)

如果当前时间和目标时间的距离(秒)大于 cutoff 的值(秒),则显示组件的默认内容(textContent)。

原文: https://www.mipengine.org/v2/components/presentation/mip-timeago.html