diff --git a/jero-web/src/components/tableDate/index.vue b/jero-web/src/components/tableDate/index.vue index 2a97a07fa..20e99a3f8 100644 --- a/jero-web/src/components/tableDate/index.vue +++ b/jero-web/src/components/tableDate/index.vue @@ -27,7 +27,7 @@ - {{text}} + {{text}} @@ -110,6 +110,14 @@ this.getTableList() }, methods: { + + getTextWith(text, fontStyle) { + var canvas = document.createElement('canvas') + var context = canvas.getContext('2d') + context.font = fontStyle || '14px' // 设置字体样式 + var dimension = context.measureText(text) + return dimension.width + 40 + }, getData() { let params = { flag: this.flag @@ -134,10 +142,12 @@ }) let width = 0 if (this.OperationList.length > 0) { - this.OperationList.forEach((res) => { - width += res.text.length * 5 + width - }) + for (let i = 0; i < this.OperationList.length; i++) { + console.log(width) + width += this.getTextWith(this.OperationList[i].text) + } } + console.log(width) if (this.showAction) { this.columns.push({ title: this.$t('operation'), @@ -171,7 +181,7 @@ this.dataSource = res.result.records this.total = res.result.total this.loading = false - }else{ + } else { this.loading = false } }) @@ -192,7 +202,7 @@ this.$emit(ol.ClickEvent, item) }, detailClick(item, index) { - this.$emit('detailClick',item) + this.$emit('detailClick', item) } } } diff --git a/jero-web/src/views/documentManage/library/index.vue b/jero-web/src/views/documentManage/library/index.vue index 0e8fa3972..28dbe33c5 100644 --- a/jero-web/src/views/documentManage/library/index.vue +++ b/jero-web/src/views/documentManage/library/index.vue @@ -103,7 +103,7 @@ { text: '删除', ClickEvent: 'deleteTable' - } + }, ], selectedRowKeys: [], loading: false,