All files / src/components/u-table-view.vue column-group.vue

100% Statements 12/12
50% Branches 1/2
100% Functions 1/1
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55      7x   7x     7x                                                                                            
<template>
<div v-show="false">
    <div>
        <slot name="title"></slot>
        <slot></slot>
    </div>
</div>
</template>
<script>
import MEmitter from '../m-emitter.vue';
 
export default {
    name: 'u-table-view-column-group',
    parentName: 'u-table-view',
    mixins: [MEmitter],
    props: {
        title: String,
        fixed: { type: Boolean, default: false },
        thEllipsis: { type: Boolean, default: undefined }, // 表头是否缩略展示
    },
    data() {
        return {
            parentVM: undefined,
            isGroup: true,
        };
    },
    mounted() {
        this.$contact('u-table-view', (parentVM) => {
            this.parentVM = parentVM;
            parentVM.columnVMsMap[this._uid] = {
                vnode: this.$vnode,
                columnVM: this,
            };
            parentVM.columnGroupVMs[this._uid] = {
                groupVM: this,
            };
            this.$dispatch(
                ($parent) => $parent.$options.name && $parent.$options.name === 'u-table-view',
                'handle-columns',
            );
        });
    },
    destroyed() {
        this.$contact('u-table-view', (parentVM) => {
            parentVM.columnVMsMap[this._uid] = null;
            parentVM.columnGroupVMs[this._uid] = null;
            this.$dispatch(
                ($parent) => $parent.$options.name && $parent.$options.name === 'u-table-view',
                'handle-columns',
            );
        });
    },
};
</script>