提交 da1f87e8 编写于 作者: 雪洛's avatar 雪洛

feat: web端启用resize-observer示例

上级 1753dd81
...@@ -1305,12 +1305,12 @@ ...@@ -1305,12 +1305,12 @@
"backgroundColorContent": "#fffae8" "backgroundColorContent": "#fffae8"
} }
} }
// #ifdef APP-ANDROID // #ifdef APP-ANDROID || WEB
,{ ,{
"path" : "pages/API/resize-observer/resize-observer", "path" : "pages/API/resize-observer/resize-observer",
"style" : "style" :
{ {
"navigationBarTitleText" : "resize0bserver" "navigationBarTitleText" : "resize bserver"
} }
}, },
// #endif // #endif
......
describe('api-resize-observer', () => { describe('api-resize-observer', () => {
if (!process.env.uniTestPlatformInfo.startsWith('android')) { if (
!process.env.uniTestPlatformInfo.startsWith('android') &&
!process.env.uniTestPlatformInfo.startsWith('web')
) {
it('dummyTest', async () => { it('dummyTest', async () => {
expect(1).toBe(1) expect(1).toBe(1)
}) })
......
...@@ -70,14 +70,14 @@ ...@@ -70,14 +70,14 @@
methods: { methods: {
innerBoxClick() { innerBoxClick() {
if (this.innerBoxElement != null) { if (this.innerBoxElement != null) {
this.innerBoxElement!.style.setProperty("width", 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) this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset + 'px')
} }
}, },
outBoxClick() { outBoxClick() {
if (this.outBoxElement != null) { if (this.outBoxElement != null) {
this.outBoxElement!.style.setProperty("width", 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) this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset + 'px')
} }
}, },
revertBoxSize() { revertBoxSize() {
......
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
api: ["Element.takeSnapshot"] api: ["Element.takeSnapshot"]
}, },
// #endif // #endif
// #ifdef APP-ANDROID // #ifdef APP-ANDROID || WEB
{ {
name: 'element大小变化监听', name: 'element大小变化监听',
url: 'resize-observer' url: 'resize-observer'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册