如何在 React-Native App 中使用 Numeral.js 或任何 JS 插件?
How to use Numeral.js or any JS plugins in React-Native App?
我需要在 React-Native 中将数字更改为货币格式
这对我来说不起作用:
import Numeral from "numeral";
Numeral(100).format("[=11=].00")
它输出:Metro Bundler 遇到内部错误。
我知道 Numeral 不是为 React-Native 构建的,但是否有解决方法或任何替代方法?
下面是使用数库的步骤:
- 在您的应用程序文件夹中执行
npm install --save numeral
- 像这样导入数字库
import numeral from 'numeral'
- 像这样在你想放的地方使用它
numeral(100).format('[=12=],0.00')
您可以从网站上看到另一种格式和文档http://numeraljs.com/
我需要在 React-Native 中将数字更改为货币格式 这对我来说不起作用:
import Numeral from "numeral";
Numeral(100).format("[=11=].00")
它输出:Metro Bundler 遇到内部错误。 我知道 Numeral 不是为 React-Native 构建的,但是否有解决方法或任何替代方法?
下面是使用数库的步骤:
- 在您的应用程序文件夹中执行
npm install --save numeral
- 像这样导入数字库
import numeral from 'numeral'
- 像这样在你想放的地方使用它
numeral(100).format('[=12=],0.00')
您可以从网站上看到另一种格式和文档http://numeraljs.com/