Skip to content

Commit 94ce683

Browse files
author
Kenneth Cheng
committed
bug fixed for sep move
1 parent e8a6f7c commit 94ce683

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/VueExcelEditor.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
</template>
276276

277277
<script>
278+
import {getCurrentInstance, defineComponent} from 'vue'
278279
import VueExcelFilter from './VueExcelFilter.vue'
279280
import PanelFilter from './PanelFilter.vue'
280281
import PanelSetting from './PanelSetting.vue'
@@ -284,7 +285,7 @@ import {read, writeFile, utils} from 'xlsx'
284285
285286
import '@vuepic/vue-datepicker/dist/main.css'
286287
287-
export default {
288+
export default defineComponent({
288289
components: {
289290
'vue-excel-filter': VueExcelFilter,
290291
'panel-filter': PanelFilter,
@@ -1517,8 +1518,11 @@ export default {
15171518
const getStyleVal = (elm, css) => {
15181519
window.getComputedStyle(elm, null).getPropertyValue(css)
15191520
}
1521+
const index = Array.from(this.labelTr.children).indexOf(e.target.parentElement)
15201522
this.sep = {}
1521-
this.sep.curCol = this.colgroupTr.children[Array.from(this.labelTr.children).indexOf(e.target.parentElement)]
1523+
// this.sep.curCol = this.colgroupTr.children[Array.from(this.labelTr.children).indexOf(e.target.parentElement)]
1524+
this.sep.curCol = this.colgroupTr.children[index]
1525+
this.sep.curField = this.fields[index - 1]
15221526
// this.sep.nxtCol = this.sep.curCol.nextElementSibling
15231527
this.sep.pageX = e.pageX
15241528
let padding = 0
@@ -1564,7 +1568,10 @@ export default {
15641568
colSepMouseMove (e) {
15651569
if (!this.sep || !this.sep.curCol) return
15661570
const diffX = e.pageX - this.sep.pageX
1567-
this.sep.curCol.style.width = (this.sep.curColWidth + diffX) + 'px'
1571+
// this.sep.curCol.style.width = (this.sep.curColWidth + diffX) + 'px'
1572+
const newWidth = (this.sep.curColWidth + diffX) + 'px'
1573+
this.sep.curCol.style.width = newWidth
1574+
this.sep.curField.width = newWidth
15681575
this.lazy(this.calStickyLeft, 200)
15691576
},
15701577
colSepMouseUp (e) {
@@ -2736,7 +2743,7 @@ export default {
27362743
}, delay)
27372744
}
27382745
}
2739-
}
2746+
})
27402747
</script>
27412748
27422749
<style scoped>

0 commit comments

Comments
 (0)