vue el-table 自定义表头 el-select使用

el-table有一个自定义属性render-header


        < el-table-column v-for="(headItem,index ) in tableHead" :key=index"

        align="center"

        :prop="headItem.value"

        :label=""

:render-header = 'renderHeader'>

renderHeaderBill方法使用:

renderHeader(h, data) {

    let filters = [{text:'全部1','value':"1"} ,{text:'全部2','value':"2"} ,{text:'全部3','value':"3"}];

return h('div',{

style: {

height:'30px'

        },

    },[

h(

"el-select",

            {

props: {

placeholder:'',

                    value: '',//默认值

                    clearable:false,

                    popperClass:'popperClassResOut',//样式

                },

                class: selectClass,

                on: {

input: value => {

this.$emit("update:param", value);

            //select 选中值

                        }

                        this.callback &&this.callback();

                    }

}

},

            [

filters.map(item => {

return h("el-option", {

props: {

                    value: item.value,

                            label: item.text

                        }

});

                })

])

])

},

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 这篇笔记主要包含 Vue 2 不同于 Vue 1 或者特有的内容,还有我对于 Vue 1.0 印象不深的内容。关于...
    云之外阅读 5,095评论 0 29
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,253评论 19 139
  • "use strict";function _classCallCheck(e,t){if(!(e instanc...
    久些阅读 2,068评论 0 2
  • 困, 方框之间, 口里哪来的树? 痴心妄想。 困了, 不想动了, 树可以永久呆在那里笑看风云, 可我们不是树, 那...
    想飞的树不如草阅读 83评论 0 0
  • 家中菊暖抱成团,昨夜已开今日看。 陶篱不见凌霜采,瘦影无须守岁寒。
    雪窗_武立之阅读 246评论 2 8