feat: resize add offse value
parent
184f6cac2f
commit
5295279a76
|
@ -58,6 +58,7 @@ const VueResizeObserver = defineComponent({
|
||||||
handleResize(entries) {
|
handleResize(entries) {
|
||||||
const { target } = entries[0];
|
const { target } = entries[0];
|
||||||
const { width, height } = target.getBoundingClientRect();
|
const { width, height } = target.getBoundingClientRect();
|
||||||
|
const { offsetWidth, offsetHeight } = target;
|
||||||
/**
|
/**
|
||||||
* Resize observer trigger when content size changed.
|
* Resize observer trigger when content size changed.
|
||||||
* In most case we just care about element size,
|
* In most case we just care about element size,
|
||||||
|
@ -67,7 +68,7 @@ const VueResizeObserver = defineComponent({
|
||||||
const fixedHeight = Math.floor(height);
|
const fixedHeight = Math.floor(height);
|
||||||
|
|
||||||
if (this.width !== fixedWidth || this.height !== fixedHeight) {
|
if (this.width !== fixedWidth || this.height !== fixedHeight) {
|
||||||
const size = { width: fixedWidth, height: fixedHeight };
|
const size = { width: fixedWidth, height: fixedHeight, offsetWidth, offsetHeight };
|
||||||
this.width = fixedWidth;
|
this.width = fixedWidth;
|
||||||
this.height = fixedHeight;
|
this.height = fixedHeight;
|
||||||
this.__emit('resize', size);
|
this.__emit('resize', size);
|
||||||
|
|
Loading…
Reference in New Issue