反应js

时间:2018-01-14 06:03:24

标签: javascript arrays reactjs

我有一个包含价格的数组,所以我想添加货币。

我谷歌并在反应中找到一种使用货币的方法是使用import react-format-currency。但是在我练习之后并不是我想要的。事实上,价格数据已经与其货币一起出现,但它在文本框中。我想要的只是使用没有文本框的货币的数据价格。怎么可能?

这是我的数组

[
    {"item" : "abc", "price" : 10000,},
    {"item" : "def", "price" : 25000,}

显示

import Currency from 'react-format-currency';
----------------------------------------------
this.state.json.map((data, i) => {
    return (         
        <h6><Currency value={data.price} currency="IDR" /></H6>
    );
})} 

2 个答案:

答案 0 :(得分:0)

您可以使用React intl来显示格式化的数字/货币。

Traceback (most recent call last):   File
"/Users/username/PycharmProjects/WebScraper2.0/web.py", line 8, in
 <module>
     soup = BeautifulSoup(thepage, "html.parser")   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/bs4/__init__.py",
 line 192, in __init__
     elif len(markup) <= 256 and ( TypeError: object of type 'Response' has no len()

示例 - https://react-xhehe2.stackblitz.io

答案 1 :(得分:0)

您可能不需要其他第三方软件包。使用内置from subprocess import check_output import os def Mounting(): print "Mounting" print "Mount CD and Press Enter" raw_input ("Press Enter to continue...") for x in range(0,5): mount_status = check_output (["mount", "/dev/sr{}".format(x), "/mnt"]) if mount_status.strip() == "mount: /dev/sr1 is write-protected, mounting read-only": break elif "is already mounted on /mnt" in mount_status.strip(): print "/mnt has already mounted. Unmount /mnt and rerun the script" sys.exit()

Intl.NumberFormat