- 35
- 0
- 共 0 条
- 全部回答
-
芋头焖排骨 普通会员 1楼
在Element UI中,可以通过自定义El-Tab组件和自定义El-Panel组件来实现头部固定,以及当El-Panel超出高度时滚动的功能。
以下是一个简单的示例:
- 定义自定义El-Tab组件:
```javascript import { Tab, Panel } from 'element-ui';
export default { extends: Tab, props: { name: { type: String, required: true }, content: { type: Array, default: () => [] }, header: { type: String, default: () => '' }, footer: { type: String, default: () => '' }, }, render: (h) => { return h('div', { key: this.$index, style: { position: 'fixed', top: 0, left: 0, width: '100%', height: '100%', overflow: 'auto', background-color: '#fff', zIndex: 9999, }, children: this.content.map((item, index) => h('div', { key: index, style: { position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', top:
${index * 100}%, left:${index * 100}%, padding: '10px', border: '1px solid #ccc', borderRadius: 5px, width:${100 - item.length * 100}%, height:${item.length * 100}%, overflow: 'hidden', }), })), footer: h('div', { key: this.$index, style: { position: 'absolute', bottom: 0, left: 0, width: '100%', height: '100%', overflow: 'auto', background-color: '#fff', zIndex: 9999, }, }), }); }, }; ```- 定义自定义El-Panel组件:
```javascript import { Panel } from 'element-ui';
export default { extends: Panel, props: { name: { type: String, required: true }, content: { type: Array, default: () => [] }, header: { type: String, default: () => '' }, footer: { type: String, default: () => '' }, }, render: (h) => { return h('div', { key: this.$index, style: { position: 'fixed', top: 0, left: 0, width: '100%', height: '100%', overflow: 'auto', background-color: '#fff', zIndex: 9999, }, children: this.content.map((item, index) => h('div', { key: index, style: { position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', top:
${index * 100}%, left:${index * 100}%, padding: '10px', border: '1px solid #ccc', borderRadius: 5px, width:${100 - item.length * 100}%, height:${item.length * 100}%, overflow: 'hidden', }), })), footer: h('div', { key: this.$index, style: { position: 'absolute', bottom: 0, left: 0, width: '100%', height: '100%', overflow: 'auto', background-color: '#fff', zIndex: 9999, }, }), }); }, }; ```然后在你的代码中使用这些组件:
```javascript
Tab 1 Tab 2 Tab 1 Tab 2 显示内容 ```
在这个例子中,当用户点击Tab 1或Tab 2时,content数组中的相应项会显示。如果用户点击Tab 1,内容数组中的Tab 1会显示,内容数组中的Tab 2会隐藏,反之亦然。
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部

