如何在选择下拉菜单中添加图标?
我的代码是:
import React, { Component } from 'react';
import Icon from '@mdi/react'
import { mdiFormatAlignLeft } from '@mdi/js';
import { mdiCheckboxMarked } from '@mdi/js';
import { IoMdRadioButtonOn } from 'react-icons/io';
class AddNewQuestion extends Component {
render() {
return (
<div>
<select>
<option value='multiple'><Icon path={mdiCheckboxMarked} /> Multiple choice</option>
<option value='single'><IoMdRadioButtonOn /> Single choice</option>
<option value='open'><Icon path={mdiFormatAlignLeft} /> Open question</option>
</select>
</div>
)
}
}
我试图将 MD 图标作为网络字体,如下所述:https ://dev.materialdesignicons.com/getting-started/webfont但我也得到了 [object Object]。
任何想法如何做到这一点?