多页签组件 MultiTabs

何时使用

多页签组件(基于应用平台)

如何使用

import AcMultiTabs from 'ac-multi-tabs';
import 'ac-multi-tabs/dist/index.css';

能力特性

多页签组件

基于应用平台

查看源码

API

参数 类型 默认值 是否必填 说明
activeKey `String Number`
menus Array 显示的页签数组
onChange Function(newMenus, target) 页签数组发生改变时触发

注意事项

暂无

更新日志

暂无
多页签组件
JS代码
/**
 *
 * @title 多页签组件
 * @description 基于应用平台
 *
 */

import React, { Component } from 'react';
import {Button} from 'tinper-bee';
import AcMultiTabs from 'ac-multi-tabs';

let index = 0;
class Demo1 extends Component {
    constructor(props){
        super(props);
        this.state = {
            menus: [{
                id: 0,
                router: 'home',
                title: "home"
            }]
        }
    }

    // 增加
    add = (e) => {
        e.stopPropagation();
        ++index;
        const newTab = {
            id: index++ ,
            title: `节点: ${index}`,
            router: `/节点: ${index}`,
        };
        this.setState({
            menus: this.state.menus.concat(newTab),
        });
    }

    handleChange = (v) => {
        console.log(v)
        this.setState({
            menus : v
        })
    }
    
    render () {
        const { menus } = this.state;
        return (
            <div className="demoPadding">
                <Button colors="primary" onClick={this.add} style={{margin: '8px'}}>增加</Button>
                <AcMultiTabs menus={menus} onChange={this.handleChange}/>
            </div>
        )
    }
}