Skip to content

Commit

Permalink
fix: dom calc error
Browse files Browse the repository at this point in the history
  • Loading branch information
wangsizhu0504 committed Jan 17, 2024
1 parent fe3bc08 commit 9e97dd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
},
);
Object.assign(titleLenRef.value, stateLenMap);
console.log('dataSource', dataSource);

return dataSource;
},
fetchSetting: { listField: 'records' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ export default defineComponent({
const dom = document.createElement('span');
dom.style.display = 'inline-block';
dom.style.fontSize = '10px';
dom.style.padding = '0 3px';
dom.style.borderRadius = '1px';
dom.textContent = props.maxTitle;
document.body.appendChild(dom);
const width = dom.clientWidth;
const width = dom.clientWidth + 2;
document.body.removeChild(dom);
return width;
});
Expand All @@ -177,7 +179,7 @@ export default defineComponent({
};
const getStyle = computed(() => {
if (tagWidth.value > 0) {
return { minWidth: `${tagWidth.value}px`, textAlign: 'center' };
return { width: `${tagWidth.value}px`, textAlign: 'center' };
}
return {};
});
Expand Down

0 comments on commit 9e97dd8

Please sign in to comment.