Comments (4)
可以提供更多的信息么 目前的信息看不出问题在哪里
from molecule.
这是完整的代码:
const BusInfo = (props: any) => {
const {
bus
} = props
const ConsTabItems: ITabProps[] = [
{
id: 'businfo_info',
name: localize('', '信息'),
closable: false,
renderPane: ()=>{
return <div>test</div>
},
},
{
id: 'businfo_bind',
name: localize('', '绑定'),
closable: false,
renderPane: ()=>{
return <div>test</div>
},
}
]
const [tabItems, setTabItems] = useState(ConsTabItems)
const [activeTab, setActiveTab] = useState('businfo_info')
useEffect(() => {
}, [])
const handleSelTab = (id: any) => {
setActiveTab(id)
}
return (
<div >
<div className={'bus-header'}>
<span>{bus?.name}</span>
</div>
<div style={{ height: 300 }}>
<Tabs
activeTab={activeTab}
data={tabItems}
onSelectTab={handleSelTab}
type={'card'} />
</div>
</div>
)
}
export default BusInfo
我希望点击对应的Tab的时候在下方渲染出renderPane的内容,但是并没有,请问应该如何修改代码。另外有没有什么方法可以修改每个Tab显示文字的宽度,谢谢。
from molecule.
Molecule 这边的 Tabs 组件只负责渲染 Tabs 的 Header 内容。内容需要自行调用 renderPane 去渲染。至于 Tabs 的类型上会有 renderPane 的原因是因为 Molecule 里面复用了这个类型,这是一件可以优化点。事实上 Tabs 组件并没有用 renderPane。
可以参考 Panel 组件的源码实现:
另外有没有什么方法可以修改每个Tab显示文字的宽度
可以直接修改文案的 padding 值,比如:
.mo-panel__header .mo-tab__item{
padding: 0 20px;
}
from molecule.
明白了,谢谢
from molecule.
Related Issues (20)
- bug: cannot set properties of undefined (setting 'apex') HOT 3
- After pressing the item in the sidebar, 'molecule.editor.open()' will run. HOT 5
- 如果需要支持 git 版本控制,该怎么做呢? HOT 1
- Molecule 2.0 TODO List HOT 6
- <Workbench />组件类型问题导致项目启动报错 HOT 9
- notification menuBar
- 请问molecule支持自定义FolderTree文件图标吗?不想用vscode原生的icon HOT 10
- bug: 在ActivityBar之间来回切换,Sidebar内容卸载不及时导致出现残影 HOT 9
- bug: activityBar图标点击不灵敏
- MenuBar是否支持渲染自定义组件?比如一个Select选择框 HOT 2
- 怎么在自定义的css中引入Theme的颜色变量
- 提示用户保存时,关闭 editor tab 标签页 tab 没有关闭成功 HOT 6
- 请问 Editor ContextMenu 支持自定义右键菜单吗? HOT 4
- 编辑器的标签页 Editor tab 如何判断左/右侧是否还有标签页呢? HOT 2
- 怎么更新IEditorTab中的文本内容 HOT 4
- vscode插件市场支持 HOT 1
- 向molecule.editor.editorInstance中注册事件 HOT 1
- [bug]: updateTab not update tab's value which is not current tab
- How add extension for esm output ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from molecule.