Skip to content

Commit

Permalink
fix(api): 修复获取不到 Taro.preload 预加载数据的问题,fix #9175
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed May 7, 2021
1 parent 795a0d8 commit 1d461d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/taro-api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const Taro = {
}

Taro.initPxTransform = getInitPxTransform(Taro)
Taro.preload = getPreload(Taro)
Taro.preload = getPreload(Current)
Taro.pxTransform = getPxTransform(Taro)

export default Taro
6 changes: 3 additions & 3 deletions packages/taro-api/src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ export function Behavior (options) {
return options
}

export function getPreload (taro) {
export function getPreload (current) {
return function (key, val) {
if (typeof key === 'object') {
taro.preloadData = key
current.preloadData = key
} else if (key !== undefined && val !== undefined) {
taro.preloadData = {
current.preloadData = {
[key]: val
}
}
Expand Down

0 comments on commit 1d461d5

Please sign in to comment.