diff --git a/demo/components/advanceTableDemo.vue b/demo/components/advanceTableDemo.vue index ca37b97b4..d0d1abb24 100644 --- a/demo/components/advanceTableDemo.vue +++ b/demo/components/advanceTableDemo.vue @@ -665,7 +665,7 @@ export default { d = d.map((item, idx) => { return { name: 'xiaobai' + idx + '218212198379821739821', - age: 10 + Math.ceil(Math.random() * 10) + age: '1' } }) console.log(d) @@ -700,6 +700,20 @@ export default { }], onFilter: 'custom' }, + { + title: '#', + render: (h, params) => { + return ( + this.handleClick(params)} + > + delete + + ) + } + }, { title: 'Age', key: 'age', @@ -747,6 +761,20 @@ export default { key: 'name', width: 300 }, + { + title: '#', + render: (h, params) => { + return ( + this.handleClick(params)} + > + delete + + ) + } + }, { title: 'Age', key: 'age', diff --git a/package.json b/package.json index 033063950..0878d4515 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "naive-ui", - "version": "0.2.15", + "version": "0.2.17", "description": "", "main": "index.js", "scripts": { diff --git a/packages/common/AdvanceTable/src/main.vue b/packages/common/AdvanceTable/src/main.vue index 3fca2992d..1d0fa7ad3 100644 --- a/packages/common/AdvanceTable/src/main.vue +++ b/packages/common/AdvanceTable/src/main.vue @@ -16,6 +16,7 @@ @@ -23,8 +24,7 @@ @@ -265,27 +265,29 @@ export default { colGroup () { return { width: `100%` } }, - headColStl () { - let width = ( - (this.wrapperWidth - this.scrollBarWidth) / - this.columns.length - ).toFixed(3) - return { - width: width + 'px', - 'padding-right': this.scrollBarWidth + 'px', - minWidth: width + 'px' - } - }, - colStl () { - let width = ( - (this.wrapperWidth - this.scrollBarWidth) / - this.columns.length - ).toFixed(3) - return { - width: width + 'px', - minWidth: width + 'px' - } - }, + // headColStl () { + // let width = ( + // (this.wrapperWidth - this.scrollBarWidth) / + // this.columns.length + // ).toFixed(3) + // return '' + // return { + // width: width + 'px', + // 'padding-right': this.scrollBarWidth + 'px', + // minWidth: width + 'px' + // } + // }, + // colStl () { + // return '' + // let width = ( + // (this.wrapperWidth - this.scrollBarWidth) / + // this.columns.length + // ).toFixed(3) + // return { + // width: width + 'px', + // minWidth: width + 'px' + // } + // }, headColWidth () { return ( (this.wrapperWidth - this.scrollBarWidth) / @@ -334,12 +336,16 @@ export default { console.log(this.wrapperWidth, this.tbodyWidth) this.init() - window.addEventListener('resize', this.init) + // window.addEventListener('resize', this.init) }, beforeDestroy () { - window.removeEventListener('resize', this.init) + // window.removeEventListener('resize', this.init) }, methods: { + onBodyScrolll (event) { + this.$refs.header.$el.scrollLeft = event.target.scrollLeft + event.stopPropagation() + }, computeCustomWidthStl (column) { if (column.width) { let width = column.width