提交 0f3ffe1c 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

docs(onWindowResize): 修复示例代码错误问题

上级 cc8e1487
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
**代码示例** **代码示例**
```javascript ```javascript
uni.onWindowResize((res) => { const windowResizeCallback = (res) => {
console.log('变化后的窗口宽度=' + res.size.windowWidth) console.log('变化后的窗口宽度=' + res.size.windowWidth)
console.log('变化后的窗口高度=' + res.size.windowHeight) console.log('变化后的窗口高度=' + res.size.windowHeight)
}) }
uni.onWindowResize(windowResizeCallback)
``` ```
**TIPS** **TIPS**
...@@ -39,10 +40,11 @@ uni.onWindowResize((res) => { ...@@ -39,10 +40,11 @@ uni.onWindowResize((res) => {
|:-:|:-:|:-:|:-:|:-:|:-:|:-:| |:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|√|√|√|x|x|x|√| |√|√|√|x|x|x|√|
**Tips**
- `CALLBACK`为调用`uni.onWindowResize`时传入的`CALLBACK`
**代码示例** **代码示例**
```javascript ```javascript
uni.offWindowResize(() => { uni.offWindowResize(windowResizeCallback)
console.log('取消监听窗口尺寸变化事件')
})
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册