iview怎么动态改变列的顺序呢?

<Table ref="selection" :columns="tableColumns" :data="tableData" size="small"></Table>
computed: {
    tableColumns () { 
        let columns = []; 
        if (this.showCheckbox) { 
            columns.push({
            type: 'selection', 
            width: 60, 
            align: 'center' 
        }) 
     }
       if (this.showIndex) {
           columns.push({ type: 'index', width: 60, align: 'center' 
       })
    } 
    columns.push({ title: 'Date', key: 'date', sortable: true });
    columns.push({ title: 'Name', key: 'name' });
    columns.push({ title: 'Address', key: 'address', key: 'address' }); 
    return columns; 
    } 
}

比如我要把最后一列上移到第一位,或者把第二列移动到第三列,每个列可以手动排序

阅读 2.3k
1 个回答
tableColumns.unshit(tableColumns.pop())
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题