Skip to content

table 中 columns 的 slots : { title: 'xxx' } 是否可换成 scopedSlots: { title: 'xxx' }, #4318

Answered by chaiwei
chaiwei asked this question in Q&A
Discussion options

You must be logged in to vote

Oh, nvm.. Found the alternative solution with customHeaderCell.

References:
#1366
https://vuejs.org/v2/guide/render-function.html#The-Data-Object-In-Depth

 computedColumns() {
    if (Array.isArray(this.columns)) {
        let columns = [];
        this.columns.forEach(element => {
            if (element.tooltips && !element.customHeaderCell) {
                element.customHeaderCell = (column) => {
                    return { 
                        attrs: {
                            title: element.tooltips
                        }
                    }
                };
            }
            columns.push(element);
        });
        return columns;
    } else {
        retu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by chaiwei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant