ttk-app-core
Version:
@ttk/recat enterprise develop framework
26 lines (24 loc) • 595 B
JavaScript
import { Map, List, fromJS } from 'immutable'
export function panes(state = List([
{ title: 'Tab 1', content: 'Content of Tab 1', key: '1' },
{ title: 'Tab 2', content: 'Content of Tab 2', key: '2' },
{
title: 'Tab 3',
content: 'Content of Tab 3',
key: '3',
closable: false,
},
]), action) {
switch (action.type) {
case 'add':
return state.push(action.data)
case 'remove':
state = state.filter((item) => {
return action.data.key !== item.key
})
console.log(2222, state)
return state
default:
return state
}
}