Skip to content

Commit c1d0247

Browse files
author
chenjiajun79
committed
fix(taro-components-advanced): 修复 Taro.xxx 调用报错
1 parent 5d19bfa commit c1d0247

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/taro-components-advanced/src/components/water-flow/root.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-labels */
2-
import Taro from '@tarojs/taro'
2+
import { nextTick } from '@tarojs/taro'
33

44
import { getRectSizeSync } from '../../utils'
55
import { Node } from './node'
@@ -167,7 +167,7 @@ export class Root extends StatefulEventBus<RootState, Events> {
167167
*
168168
*/
169169
renderInitialLayout(i = 0) {
170-
Taro.nextTick(() => {
170+
nextTick(() => {
171171
const sectionSize = this.sections.length
172172

173173
if (i >= sectionSize || i < 0) {

packages/taro-components-advanced/src/components/water-flow/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Taro from '@tarojs/taro'
1+
import { getEnv, getSystemInfoSync } from '@tarojs/taro'
22

3-
let sysInfo: ReturnType<typeof Taro.getSystemInfoSync>
3+
let sysInfo: ReturnType<typeof getSystemInfoSync>
44

55
export const getSysInfo = () => {
66
if (sysInfo) return sysInfo
7-
sysInfo = Taro.getSystemInfoSync()
7+
sysInfo = getSystemInfoSync()
88
return sysInfo
99
}
1010

@@ -51,4 +51,4 @@ export const createImperativePromise = () => {
5151
}
5252
}
5353

54-
export const isWeb = () => Taro.getEnv().toLowerCase() === 'web'
54+
export const isWeb = () => getEnv().toLowerCase() === 'web'

packages/taro-components-advanced/src/components/water-flow/water-flow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ScrollViewProps,
55
View,
66
} from '@tarojs/components'
7-
import Taro from '@tarojs/taro'
7+
import { nextTick } from '@tarojs/taro'
88
import {
99
Children,
1010
cloneElement,
@@ -169,7 +169,7 @@ export function WaterFlow({
169169
if (!targetSection.getState().layouted) {
170170
const order = targetSection.order
171171
root.setStateIn('renderRange', [renderRange$[0], order])
172-
Taro.nextTick(async () => {
172+
nextTick(async () => {
173173
await targetNode.section.layoutedSignal.promise
174174
scrollTo(targetNode.getState().scrollTop)
175175
})

0 commit comments

Comments
 (0)