From da1f87e8befbb1bbf2abeb51ec3797d2f523d2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Thu, 9 May 2024 15:59:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20web=E7=AB=AF=E5=90=AF=E7=94=A8resize-ob?= =?UTF-8?q?server=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 4 ++-- pages/API/resize-observer/resize-observer.test.js | 5 ++++- pages/API/resize-observer/resize-observer.uvue | 8 ++++---- pages/tabBar/API.uvue | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pages.json b/pages.json index cefb9d27..72427374 100644 --- a/pages.json +++ b/pages.json @@ -1305,12 +1305,12 @@ "backgroundColorContent": "#fffae8" } } - // #ifdef APP-ANDROID + // #ifdef APP-ANDROID || WEB ,{ "path" : "pages/API/resize-observer/resize-observer", "style" : { - "navigationBarTitleText" : "resize0bserver" + "navigationBarTitleText" : "resize bserver" } }, // #endif diff --git a/pages/API/resize-observer/resize-observer.test.js b/pages/API/resize-observer/resize-observer.test.js index fb854f89..22160835 100644 --- a/pages/API/resize-observer/resize-observer.test.js +++ b/pages/API/resize-observer/resize-observer.test.js @@ -1,5 +1,8 @@ describe('api-resize-observer', () => { - if (!process.env.uniTestPlatformInfo.startsWith('android')) { + if ( + !process.env.uniTestPlatformInfo.startsWith('android') && + !process.env.uniTestPlatformInfo.startsWith('web') + ) { it('dummyTest', async () => { expect(1).toBe(1) }) diff --git a/pages/API/resize-observer/resize-observer.uvue b/pages/API/resize-observer/resize-observer.uvue index a03e7e32..d2377add 100644 --- a/pages/API/resize-observer/resize-observer.uvue +++ b/pages/API/resize-observer/resize-observer.uvue @@ -70,14 +70,14 @@ methods: { innerBoxClick() { if (this.innerBoxElement != null) { - this.innerBoxElement!.style.setProperty("width", this.innerBoxElement!.offsetWidth + this.offset) - this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset) + this.innerBoxElement!.style.setProperty("width", this.innerBoxElement!.offsetWidth + this.offset + 'px') + this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset + 'px') } }, outBoxClick() { if (this.outBoxElement != null) { - this.outBoxElement!.style.setProperty("width", this.outBoxElement!.offsetWidth + this.offset) - this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset) + this.outBoxElement!.style.setProperty("width", this.outBoxElement!.offsetWidth + this.offset + 'px') + this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset + 'px') } }, revertBoxSize() { diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue index 5d23df70..f3d312fb 100644 --- a/pages/tabBar/API.uvue +++ b/pages/tabBar/API.uvue @@ -166,7 +166,7 @@ api: ["Element.takeSnapshot"] }, // #endif - // #ifdef APP-ANDROID + // #ifdef APP-ANDROID || WEB { name: 'element大小变化监听', url: 'resize-observer' -- GitLab