【问题标题】:How to use Select in preact-material-components如何在 preact-material-components 中使用 Select
【发布时间】:2018-02-04 01:11:33
【问题描述】:

我在 PWA 上使用 preact-material-components

我想添加一个选择菜单,这样我就可以这样做:

import { h, Component } from 'preact';
import Select from 'preact-material-components/Select';
import 'preact-material-components/Select/style.css';

然后

export default class Home extends Component {
    render() {
        return (
            <div class={style.home}>
                <h1>Home route</h1>

                <Select>
                    <Select.Item>Frutas y Verduras</Select.Item>
                    <Select.Item>Farmacia</Select.Item>
                    <Select.Item>Comida Rapida</Select.Item>
                    <Select.Item>Limpieza</Select.Item>
                </Select>
            </div>
        );
    }
}

但是选择菜单看起来一点也不好看,我可以使用开发工具看到正在导入样式,但看起来 CSS 有问题,我是 React 新手,所以我想知道你的意见关于这段代码。

【问题讨论】:

  • 尝试查看github post,指导您正确使用preact-material-components

标签: reactjs progressive-web-apps preact


【解决方案1】:

如果您单独使用此组件,请不要忘记导入 'preact-material-components/Menu/style.css' 和 'preact-material-components/List/style.css'

来自https://material.preactjs.com/component/select

【讨论】:

    猜你喜欢
    • 2020-12-29
    • 2017-12-21
    • 2018-09-25
    • 2019-03-30
    • 2021-02-21
    • 1970-01-01
    • 1970-01-01
    • 2018-06-20
    • 2021-11-19
    相关资源
    最近更新 更多