0

菜鸟网络开发人员在这里。我正在使用基于树的拖放文档:链接 实时示例:此处

我想改变"Search/DropDown bar"这张图片的高度和宽度在此处输入图像描述

To be displayed like this: 在此处输入图像描述 但是有一些问题,即使内联 css 也不起作用。

主要成分是DropdownTreeSelect

请参见下面的代码:

DropDown.js

   import React, { Component } from "react";
    import DropdownTreeSelect from "react-dropdown-tree-select";
    import isEqual from "lodash/isEqual";
    import "./DownloadNFT.css";
    
export default class Container extends Component {
  constructor(props) {
    super(props);
    this.state = { data: props.data };
  }

  componentWillReceiveProps = (nextProps) => {
    if (!isEqual(nextProps.data, this.state.data)) {
      this.setState({ data: nextProps.data });
    }
  };

  shouldComponentUpdate = (nextProps) => {
    return !isEqual(nextProps.data, this.state.data);
  };

  render() {
    const { data, ...rest } = this.props;
    return (
      <DropdownTreeSelect
        className="mdl-demo"
        data={this.state.data}
        {...rest}
      />
    );
  }
}

尝试在 in-line 和 css 中进行许多更改,但样式searchbox/dropdown没有改变

下拉.css

/* fallback, until https://github.com/CompuIves/codesandbox-client/issues/174 is resolved */
@font-face {
  font-family: "Material Icons";
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2)
    format("woff2");
}

.material-icons {
  font-family: "Material Icons";
  font-weight: normal;
  font-style: normal;
  font-size: 54px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

/* mdl-demo is a custom classname to increases the specificity of our styles. It can be anything. 
 * The idea is that it is easy to extend/override builtin styles with very little effort.
 */

.mdl-demo .dropdown-trigger > span:after {
  font-size: 32px;
  color: rgb(208, 255, 0);
}

.mdl-demo .toggle {
  font: normal normal normal 18px/1 "Material Icons";
  color: #555;
  white-space: pre;
  margin-right: 4px;
}
4

1 回答 1

0
document.getElementsByClassName("search")[0].placeholder="Search collection";

在演示示例中将其放在render(<App />, document.getElementById("root")); (index.js)之后

于 2022-01-14T22:04:47.483 回答