index.js 846 Bytes
Newer Older
wanli's avatar
wanli committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
import './index.less';
import { Icon } from "ant-design-vue";
import classNames from 'classnames';
export default {
    props: {
        colorful: { default: true },
        reverseColor: { default: false },
        flag: { default: '' }
    },
    computed: {
        cls() {
            return classNames('trendItem', {
                ['trendItemGrey']: !this.colorful,
                ['reverseColor']: !this.reverseColor && !this.colorful,
            })
        }
    },
    render() {
        const { flag, cls } = this
        return (
            <div class={cls}>
                <span class='value'>{this.$slots.default}</span>
                {flag && (
                    <span class={flag}>
                        <Icon type={`caret-${flag}`} />
                    </span>
                )}
            </div>
        )
    }
}