chartPage.san 2.3 KB
Newer Older
1
<template>
B
BingBlog 已提交
2 3 4
    <div class="visual-dl-chart-page">
        <ui-expand-panel info="{{tagList.length}}" title="{{title}}">
            <div class="visual-dl-chart-box">
5 6 7
                <ui-chart
                    san-for="tag in filteredTagList"
                    tagInfo="{{tag}}"
B
BingBlog 已提交
8 9 10 11 12 13 14 15
                    groupNameReg="{{config.groupNameReg}}"
                    smoothing="{{config.smoothing}}"
                    horizontal="{{config.horizontal}}"
                    sortingMethod="{{config.sortingMethod}}"
                    downloadLink="{{config.downloadLink}}"
                    outlier="{{config.outlier}}"
                    runs="{{config.runs}}"
                    running="{{config.running}}"
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
                    runsItems="{{runsItems}}"
                ></ui-chart>
            </div>
            <ui-pagination
                san-if="total > pageSize"
                on-pageChange="handlePageChange($event)"
                current="{{currentPage}}"
                pageSize="{{pageSize}}"
                total="{{total}}"
                showSizeChanger="{{false}}"
            />
        </ui-expand-panel>
    </div>
</template>
<script>
31 32
import ExpandPanel from '../../common/component/ExpandPanel';
import chart from '../../common/component/Charts/chart';
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
import Pagination from 'san-mui/Pagination';

export default {
    components: {
        'ui-chart': chart,
        'ui-expand-panel': ExpandPanel,
        'ui-pagination': Pagination
    },
    computed: {
        filteredTagList() {
            let tagList = this.data.get('tagList') || [];
            let currentPage = this.data.get('currentPage');
            let pageSize = this.data.get('pageSize');
            return tagList.slice((currentPage - 1) * pageSize, currentPage * pageSize);
        },
        total() {
            let tagList = this.data.get('tagList') || [];
            return tagList.length;
        }
    },
    initData() {
        return {
            // current page
            currentPage: 1,
            // item per page
            pageSize: 8
        };
    },

    handlePageChange({pageNum}) {
        this.data.set('currentPage', pageNum);
    }
};
</script>
<style lang="stylus">
@import '../../style/variables';

+prefix-classes('visual-dl-')
B
BingBlog 已提交
71 72 73 74 75
    .chart-page
        .chart-box:after
            content: "";
            clear: both;
            display: block;
76 77 78
</style>