提交 3fdeeb7d 编写于 作者: crlfe's avatar crlfe 😲

fix: $nextTick 测试用例

上级 e0827005
...@@ -53,11 +53,13 @@ export default { ...@@ -53,11 +53,13 @@ export default {
}, },
methods: { methods: {
nextTickCallback (): void { nextTickCallback (): void {
this.width = 200 this.width = 100
uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => { uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => {
const rect = ret[0] as NodeInfo const rect = ret[0] as NodeInfo
this.width = 200
this.$nextTick(() => { this.$nextTick(() => {
uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => { uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => {
const newRect = ret[0] as NodeInfo const newRect = ret[0] as NodeInfo
...@@ -69,11 +71,13 @@ export default { ...@@ -69,11 +71,13 @@ export default {
}); });
}, },
nextTickPromise (): void { nextTickPromise (): void {
this.height = 200 this.height = 100
uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => { uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => {
const rect = ret[0] as NodeInfo const rect = ret[0] as NodeInfo
this.height = 200
this.$nextTick().then(() => { this.$nextTick().then(() => {
uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => { uni.createSelectorQuery().select('.rect').boundingClientRect(null).exec((ret: Array<any>) => {
const newRect = ret[0] as NodeInfo const newRect = ret[0] as NodeInfo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册