ttk-app-core
Version:
@ttk/recat enterprise develop framework
40 lines (37 loc) • 940 B
JavaScript
import { Map, List, fromJS } from 'immutable'
// export function activeKey(state = '', action) {
// switch (action.type) {
// case 'add':
// return state.concat(fromJS(action.data))
// case 'remove':
// state = state.filter((item) => {
// return action.data.key !== item.key
// })
// return state
// default:
// return state
// }
// }
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
}
}