【问题标题】:How to make the scrollbar to the top when opening the option list using the Dropdown from @fluentui/react-northstar使用@fluentui/react-northstar 的下拉菜单打开选项列表时如何将滚动条置于顶部
【发布时间】:2022-06-28 20:04:44
【问题描述】:

打开下拉选项列表时,滚动条会移动到底部。最后的选项在选择选项列表中可见。

谁能提供将列表项滚动条显示到最顶部项目的解决方案?

import React from 'react'
import { Dropdown } from '@fluentui/react-northstar';

class someComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
        currentObject: "",
        inputItems: [
            'Robert Tolbert',
            'Wanda Howard',
            'Tim Deboer',
            'Amanda Brady',
            'Ashley McCarthy',
            'Cameron Evans',
            'Carlos Slattery',
            'Carole Poland',
            'Robin Counts',
            'Test 1',
            'Test 2',
            'Test 3',
            'Test 4',
            'Test 5'
          ]
    }
  }
  **Function Called when user selects the options**
  onChangeObjectHandler(event, data){
    const objectName = data.value.header;
    this.setState({ currentObject: objectName });
  }

  render() {
    return (
      <div>
        <Dropdown
            checkable
            onChange={this.onChangeObjectHandler}
            items={this.state.inputItems}
            value={{this.state.currentObject}}
            placeholder="Select your object
        />
      </div>
    );
  }
}
export default someComponent;

【问题讨论】:

    标签: javascript reactjs fluentui-react


    【解决方案1】:

    你能告诉我,你是怎么解决这个问题的?

    【讨论】:

    猜你喜欢
    • 2021-03-31
    • 2021-09-15
    • 2021-06-28
    • 2022-08-09
    • 1970-01-01
    • 2013-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多