<template>
    <div class="nus_filterslide">
        <slot
            :itemData="myItem"
            :data="item">
        </slot>
    </div>
</template>

<script>
import { callFn } from 'nimble-lib';
export default {
    props: {
        /**
         * 数据项
         */
        item: {},
        /**
         * 过滤方法
         */
        filterItem: {
            type: Function
        }
    },
    computed: {
        /**
         * 获取过滤后的item
         * @returns {Object|String} 返回过滤后的数据
         */
        myItem () {
            const _that = this;
            let _res = callFn(_that.filterItem || _that.item, [_that.item], _that);
            if (typeof _res === 'string') {
                _res = {
                    text: _res
                };
            }
            return _res;
        }
    }
};
</script>

<style lang="scss">
@import '../../../../_assets/style/_iconFont.scss';
@import '../../../../_assets/style/_var.scss';
@import '../../../../_assets/style/_mixin.scss';
.nus_filterslide {
    width: 100%;
    height: 100%;
}
</style>
