Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatters 设计 #35

Open
z-ZYS-s opened this issue Mar 15, 2019 · 2 comments
Open

Formatters 设计 #35

z-ZYS-s opened this issue Mar 15, 2019 · 2 comments
Labels

Comments

@z-ZYS-s
Copy link
Member

z-ZYS-s commented Mar 15, 2019

需求:

  • 传统框架的 Formatters 功能比较全,前端的一般比较简陋
  • 目前 v0.4.0 的 formatters 只有3个:PlaceholderFormatter, DateFormatter, NumberFormatter
  • 其中 DateFormatter 还不是很通用,需要调研一下市面上的 Date 库。徐玲说 date-fns 比 moment 要好,对比一下还有没有别的库
  • NumberFormatter 也不是很通用。要了解一下传统框架这块是怎么实现的。还有个规范:http://www.unicode.org/reports/tr35/tr35-25.html#Numbering_Systems
  • 再思考一下别的 Formatter 的可行性。比如可以看看别的组件库,或者看看 freemarker 等其他模板语言经常有拿些字符串转换我们可以添加:https://www.cnblogs.com/JealousGirl/p/6914122.html

参考不限:

@z-ZYS-s
Copy link
Member Author

z-ZYS-s commented Mar 18, 2019

小结:

  • DateFormatter 和 NumberFormatter 使用 IntlJS 结合 vue-i18n
  • 单位转换可以自己写,参考 pretty-bytes
  • IP 转换使用 Netmask 库

研究:

  • 需要调研 NumberFormat 的数字骨架
  • 需要实现一种 Formatter 注册机制

@ghost
Copy link

ghost commented Mar 18, 2019

Date 库个人推荐一下 Day.js

功能完善 比 date-fns 体积还要小巧

⏰ Day.js 2KB immutable date library alternative to Moment.js with the same modern API

https://github.com/iamkun/dayjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant