Skip to content

任意视图展开隐藏的实现方法 #2573

Answered by bytemain
PerfectPan asked this question in Q&A
Discussion options

You must be logged in to vote

嗯,你理解的没错:在例子中 mainLayoutService 控制右边的显隐是利用它是一个 tabbarHandler 来实现的,整个 OpenSumi 的视图控制还是没有那么自由,没有那么强。

要实现你的需求的话应该得额外写一部分代码。

所以在我们支付宝的小程序 IDE 的实践里,模拟器它所在的位置还是一个 Tabbar,但是我们隐藏了它的 tab 选择栏。我们重写了这个类:
TabbarViewBase https://github.com/opensumi/core/blob/fix/extension/nls-config/packages/main-layout/src/browser/tabbar/bar.view.tsx#L261

所以我的建议是,把模拟器的区域也当成一个 tabbar 来使用,可以自己根据 TabbarViewBase 实现一个 SimulatorView,然后把 tabbar 的 tab 栏隐藏掉。

这样就可以通过 tabbarService 来控制该区域了。

拿到 tabbarService 后,可以通过 tabbarService.resizeHandle?.xxx 来更精确的控制这个区域的长宽:

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@PerfectPan
Comment options

@bytemain
Comment options

Answer selected by PerfectPan
@PerfectPan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants