reactjs - 如何使用语义-ui-react 下拉菜单
问题描述
我正在尝试使用 semantic-ui-react 和 typescript 来创建一个表单。所以我正在使用文档。但是,当我实现 dropdow 或表单时,我得到了一个没有 CSS 的基本 HTML 表单。我应该怎么做才能获得与 react.semantic-ui.com 相同的 UX
import { Dropdown } from 'semantic-ui-react'
const options = [
{ key: 1, text: 'Location 1', value: 1 },
{ key: 2, text: 'Location 2', value: 2 },
{ key: 3, text: 'Location 3', value: 3 },
]
return (
<Form>
<div>
<Dropdown
placeholder='Etat *'
title="Select Etat"
fluid
selection
options={StatusOptions}
/>
</div>
</Form>
解决方案
您需要使用 npm 安装默认主题npm i semantic-ui-css
然后将该主题导入您的app.ts
或index.ts
import 'semantic-ui-css/semantic.min.css'
推荐阅读
- git - 使用 git grep 搜索和替换 github url 字符串
- amazon-web-services - AWS 托管网站无法正常工作,会是什么问题?
- haskell - Haskell 类型注释一个简单的函数以返回一个数组
- android - ADB Root 授予应用程序或包的 Root 权限
- python - Beautiful Soup 类名有多个空格,find_all 给出 []
- amazon-web-services - 在 EC2 上运行应用程序 - 使用 RESTful API 触发它 - 自动缩放
- c - 包含glad.h时的分段错误
- spring - 在一个类上声明@configuration 会使其成为一个spring bean吗?
- entity-framework - 我应该有多少个 DbContext 类?
- lua - 使用纯 Lua 脚本对齐的文本自动换行