![](/img/trans.png)
[英]I am trying to convert my existing react app with next.js. Is it a right thing to do?
[英]I am trying to create a form in React JS using Fluent UI but the thing I noticed is that in the date picker I am missing all the icons
我正在嘗試使用 Fluent UI 在 React JS 中創建一個簡單的表單,但我注意到在日期選擇器中我在呈現時丟失了所有圖標。 這是我的代碼,任何人都可以幫助我解決我所缺少的問題。
import React from "react";
import "./App.css";
import {
DatePicker,
defaultDatePickerStrings,
Dropdown,
PrimaryButton,
TextField,
Stack
} from "@fluentui/react";
function App() {
const dropdownStyles = {
dropdown: { width: 300 },
};
const options = [
{ key: "male", text: "Male" },
{ key: "female", text: "Female" },
];
function _alertClicked() {
alert("Clicked");
}
const columnProps = {
tokens: { childrenGap: 15 },
styles: { root: { width: 300 } },
};
return (
<div>
<h1>Employee Form</h1>
<Stack {...columnProps}>
<TextField label="Enter Name" />
<DatePicker
isRequired
// firstDayOfWeek={firstDayOfWeek}
label="Date of Birth"
placeholder="Select a date..."
ariaLabel="Select a date"
strings={defaultDatePickerStrings}
/>
<Dropdown
isRequired
placeholder="Select an option"
label="Select Gender"
options={options}
styles={dropdownStyles}
/>
<TextField label="Address" multiline rows={4} />
<PrimaryButton text="Submit" onClick={_alertClicked} />
</Stack>
</div>
);
}
export default App;
您必須在應用程序的根目錄中初始化圖標:
import { initializeIcons } from '@fluentui/font-icons-mdl2';
initializeIcons();
更多信息在這里。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.