index.js 1.24 KB
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 32 33 34 35 36 37 38
import './index.less'
import { Tooltip } from "ant-design-vue";
export default {
    props: {
        target: { type: Number },
        color: {
            default: 'rgb(19, 194, 194)'
        },
        strokeWidth: { type: Number },
        percent: { type: Number },
    },
    components: {
        ATooltip: Tooltip
    },
    render() {
        const { target, color, percent, strokeWidth } = this
        return (
            <div class="miniProgress">
                <a-tooltip title={`目标值 ${target}%`}>
                    <div class='target' style={{ left: target + 'px' ? `${target}%` : null }}>
                        <span style={{ backgroundColor: color || null }} />
                        <span style={{ backgroundColor: color || null }} />
                    </div>
                </a-tooltip>
                <div class='progressWrap'>
                    <div
                        class='progress'
                        style={{
                            backgroundColor: color || null,
                            width: percent ? `${percent}%` : null,
                            height: strokeWidth + 'px' || null,
                        }}
                    />
                </div>
            </div>
        )
    }
}