这是 JavaScript 对象中的代码
const AlbumDetails = [
{
name: '<i class="fas fa-check">Basic</i>',
price: '',
details: [],
},
{ name: '<i class="fas fa-check">Intermediate</i>', price: '', details: [] },
{ name: '<i class="fas fa-check">Pro</i>', price: '', details: [] },
{ name: '<i class="fas fa-check">Ultimate</i>', price: '', details: [] },
];
export default AlbumDetails;
我想像这样使用这个对象
const PriceCard = (props) => {
<div className="p-box">
<div className="p-content">
<h2>{props.AlbumDetails[0].name}</h2>
<h4>{props.AlbumDetails[0].price}</h4>
</div>
</div>
}
很快。在浏览器中,它显示<i class="fas fa-check">Basic</i>
,但我只想要图标和名称“基本”。那么怎么可能做到。