import { mergeProps, createSignal, For } from "solid-js";

// import config from "../base/config"


import "./select.css"


function table(props) {
    const parentProps = mergeProps(props);
    const [actSelect, setActSelect] = createSignal(0);
    function selectOption(e) {
        console.log(e.target.getAttribute('code'))
        setActSelect(e.target.getAttribute('code'))
    }
    // 监听parops更新
    return <div class="local_select">
        <div class="title_select">
            <i class="icon_select iconfont icon-arrow-down"></i>
            {parentProps.title}
        </div>
        <For each={parentProps.list}>
            {li => (
                <div classList={{ 'option_select': true, 'option_act_select': li.code == actSelect() }} code={li.code} onClick={selectOption} >{li.name}</div>
            )}
        </For>
    </div>
}

export default table;
