【发布时间】:2017-07-21 16:37:56
【问题描述】:
我真的需要一个 React 组件,就像您网站上的组件一样:
我需要的是一个带标题和右侧按钮的乐队。 当你点击这个按钮时,它会打开一个下拉组件,你可以在上面调用其他组件(比如在你的网站上,有源代码,我想把其他组件放进去)
我需要一个下拉组件,使应用栏的整个宽度,例如当您单击查看源代码时在 material-ui 网站上。我需要放入我创建的其他组件,所以图标菜单不适合(您只能将 MenuItems 作为子项)。
为了更清楚,ListItem 会是完美的,但嵌套项目也只能是 List Items...所以我被阻止了。
<List>
<ListItem
primaryText="Profile 1"
initiallyOpen={false}
primaryTogglesNestedList={true}
key={1}
nestedItems={[
<ListItem
key={1-1}
primaryText="I am a list item component..."
disabled={true}
primaryTogglesNestedList={true}
/>
]}
/>
</List>
我想放入我的 ListItem 的代码是:
<TextField key={this.props.index} name="profileType" hintText="Type de profil" fullWidth={true} value={this.props.state.profileAgir.type.libelle} onChange={this.props.onChange}/>
<br />
<div>
<h2>Entités de couverture</h2>
<MyRGOCovTree onCheck={this.onCheckCov} key={this.props.index} multiple={true}/>
</div>
<div>
<h2>Entités d'exécution</h2>
<MyRGOExeTree onCheck={this.onCheckExe} key={this.props.index} multiple={true}/>
</div>
<div>
<h2>Entités juridiques</h2>
<MyEnttTree onCheck={this.onCheckEJ} key={this.props.index} />
</div>
{this.props.state.cube === "AGIR" &&
<div>
<div>
<h2>Filière</h2>
<Tree onCheck={this.onCheckFil} key={this.props.index} className="myCls" showLine showIcon={false} checkable defaultExpandedKeys={['ALL']} selectable={false} >
<TreeNode title="All" key="ALL">
<TreeNode title="Risques" key="Risques" >
<TreeNode title="Risques Opérationnels" key="Risques Opérationnels"/>
<TreeNode title="Risques de Marché" key="Risques de Marché"/>
<TreeNode title="Risques de Crédit" key="Risques de Crédit"/>
</TreeNode>
<TreeNode title="Juridique" key="Juridique" />
<TreeNode title="Finance" key="Finance" >
<TreeNode title="Comptabilité" key="Comptabilité"/>
<TreeNode title="Réglementaire" key="Réglementaire"/>
<TreeNode title="Autres" key="Autres"/>
</TreeNode>
<TreeNode title="Fiscalité" key="Fiscalité" />
<TreeNode title="Ressources Humaines" key="Ressources Humaines" />
<TreeNode title="Systèmes d'Information" key="Systèmes d'Information" >
<TreeNode title="Systèmes d'Information" key="S/Systèmes d'Information"/>
<TreeNode title="Sécurité des Systèmes d'Information" key="Sécurité des Systèmes d'Information"/>
</TreeNode>
<TreeNode title="Conformité" key="Conformité" />
<TreeNode title="Immobilier" key="Immobilier" />
<TreeNode title="Achats" key="Achats" />
<TreeNode title="Communication" key="Communication" />
</TreeNode>
</Tree>
</div>
<div>
<p> Données issues de la vue V_DWH_REF_FILIERE en DEV</p>
{this.props.filieresError && <div><i><b>{this.props.filieresError.message}</b></i></div>}
{this.props.filieresItems.length ? ( <MyFiliereTree key={this.props.index} onCheck={this.props.onCheck} items={this.props.filieresItems} checkedKeys={this.props.state.filieres}/> ) : 'loading...'}
</div>
<div>
<h2>Processus</h2>
<MyProcTree onCheck={this.onCheckProc} key={this.props.index} />
</div>
<div>
<h2>Confidentialité</h2>
<MyConfTree onCheck={this.onCheckConf} key={this.props.index} />
</div>
<div>
<h2>Application</h2>
<MyAppTree onCheck={this.onCheckApp} key={this.props.index} style={{paddingBot:20}} />
</div>
</div>
}
所以它非常大,并且充满了不同的组件。 想象一下我在material-ui网站上给你的例子,但是当你点击栏时你没有出现源代码,而是我的组件,就像一个!
如果有人有解决办法
【问题讨论】:
-
你有没有费心去查看网站? material-ui.com/#/components/app-bar
-
@azium 我当然做了,但是没有解释当你点击右键时如何得到一个下拉组件
-
@azium 我不需要一个图标菜单,而是一个下拉组件,它使应用栏的整个宽度,就像当你点击查看源代码时,你看到了吗?
-
@azium 而且,有了 IconMenu 你只能在上面放 MenuItems,但是我需要放其他我创建的组件
标签: reactjs material-ui