@tarojs/taro-h5 3.3.14 → 3.5.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro-h5",
3
- "version": "3.3.14",
3
+ "version": "3.5.0-canary.0",
4
4
  "description": "Taro h5 framework",
5
5
  "main:h5": "src/index.js",
6
6
  "main": "dist/index.cjs.js",
@@ -33,17 +33,13 @@
33
33
  "author": "O2Team",
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
- "@tarojs/api": "3.3.14",
37
- "@tarojs/router": "3.3.14",
38
- "@tarojs/runtime": "3.3.14",
36
+ "@tarojs/api": "3.5.0-canary.0",
37
+ "@tarojs/router": "3.5.0-canary.0",
38
+ "@tarojs/runtime": "3.5.0-canary.0",
39
39
  "base64-js": "^1.3.0",
40
40
  "jsonp-retry": "^1.0.3",
41
41
  "mobile-detect": "^1.4.2",
42
- "raf": "^3.4.1",
43
42
  "whatwg-fetch": "^3.4.0"
44
43
  },
45
- "devDependencies": {
46
- "jest-fetch-mock": "^3.0.3"
47
- },
48
- "gitHead": "ffd2b33c2a760094372a9ec69735ab9c4d1877e5"
44
+ "gitHead": "a0222bc41bc05b0e34413d6db3de963d777a5015"
49
45
  }
@@ -2,11 +2,9 @@ import Taro from '@tarojs/api'
2
2
  import { shouldBeObject, getParameterError, isValidColor, successHandler, errorHandler } from '../utils'
3
3
 
4
4
  let tabConf
5
- let App
6
5
 
7
- export function initTabBarApis (_App = {}) {
8
- tabConf = _App.state.__tabs
9
- App = _App
6
+ export function initTabBarApis (config = {}) {
7
+ tabConf = config.tabBar
10
8
  }
11
9
 
12
10
  /**
@@ -64,8 +62,6 @@ export function setTabBarBadge (options = {}) {
64
62
  successHandler: successHandler(success, complete),
65
63
  errorHandler: errorHandler(fail, complete)
66
64
  })
67
-
68
- return successHandler(success, complete)(res)
69
65
  }
70
66
 
71
67
  /**
@@ -109,8 +105,6 @@ export function removeTabBarBadge (options = {}) {
109
105
  successHandler: successHandler(success, complete),
110
106
  errorHandler: errorHandler(fail, complete)
111
107
  })
112
-
113
- return successHandler(success, complete)(res)
114
108
  }
115
109
 
116
110
  /**
@@ -154,8 +148,6 @@ export function showTabBarRedDot (options = {}) {
154
148
  successHandler: successHandler(success, complete),
155
149
  errorHandler: errorHandler(fail, complete)
156
150
  })
157
-
158
- return successHandler(success, complete)(res)
159
151
  }
160
152
 
161
153
  /**
@@ -199,8 +191,6 @@ export function hideTabBarRedDot (options = {}) {
199
191
  successHandler: successHandler(success, complete),
200
192
  errorHandler: errorHandler(fail, complete)
201
193
  })
202
-
203
- return successHandler(success, complete)(res)
204
194
  }
205
195
 
206
196
  /**
@@ -245,8 +235,6 @@ export function showTabBar (options = {}) {
245
235
  successHandler: successHandler(success, complete),
246
236
  errorHandler: errorHandler(success, complete)
247
237
  })
248
-
249
- return successHandler(success, complete)(res)
250
238
  }
251
239
 
252
240
  /**
@@ -291,8 +279,6 @@ export function hideTabBar (options = {}) {
291
279
  successHandler: successHandler(success, complete),
292
280
  errorHandler: errorHandler(success, complete)
293
281
  })
294
-
295
- return successHandler(success, complete)(res)
296
282
  }
297
283
 
298
284
  /**
@@ -353,10 +339,14 @@ export function setTabBarStyle (options = {}) {
353
339
  if (backgroundColor) obj.backgroundColor = backgroundColor
354
340
  if (borderStyle) obj.borderStyle = borderStyle
355
341
 
356
- const temp = Object.assign({}, tabConf, obj)
357
- App.setState && App.setState({ __tabs: temp })
358
-
359
- return successHandler(success, complete)(res)
342
+ Taro.eventCenter.trigger('__taroSetTabBarStyle', {
343
+ color,
344
+ selectedColor,
345
+ backgroundColor,
346
+ borderStyle,
347
+ successHandler: successHandler(success, complete),
348
+ errorHandler: errorHandler(success, complete)
349
+ })
360
350
  }
361
351
 
362
352
  /**
@@ -401,24 +391,12 @@ export function setTabBarItem (options = {}) {
401
391
  return errorHandler(fail, complete)(res)
402
392
  }
403
393
 
404
- if (
405
- !tabConf ||
406
- !tabConf.list ||
407
- !tabConf.list[index]
408
- ) {
409
- res.errMsg = 'setTabBarItem:fail tabbar item not found'
410
- return errorHandler(fail, complete)(res)
411
- }
412
-
413
- const obj = {}
414
- if (text) obj.text = text
415
- if (iconPath) obj.iconPath = iconPath
416
- if (selectedIconPath) obj.selectedIconPath = selectedIconPath
417
-
418
- const temp = Object.assign({}, tabConf)
419
- temp.list[index] = Object.assign({}, temp.list[index], obj)
420
-
421
- App.setState && App.setState({ __tabs: temp })
422
-
423
- return successHandler(success, complete)(res)
394
+ Taro.eventCenter.trigger('__taroSetTabBarItem', {
395
+ index,
396
+ text,
397
+ iconPath,
398
+ selectedIconPath,
399
+ successHandler: successHandler(success, complete),
400
+ errorHandler: errorHandler(success, complete)
401
+ })
424
402
  }
package/src/taro/index.js CHANGED
@@ -25,22 +25,7 @@ const {
25
25
  nextTick,
26
26
  eventCenter,
27
27
  Events,
28
- preload,
29
- useDidShow,
30
- useDidHide,
31
- usePullDownRefresh,
32
- useReachBottom,
33
- usePageScroll,
34
- useResize,
35
- useShareAppMessage,
36
- useTabItemTap,
37
- useTitleClick,
38
- useOptionMenuClick,
39
- usePullIntercept,
40
- useShareTimeline,
41
- useAddToFavorites,
42
- useReady,
43
- useRouter
28
+ preload
44
29
  } = Taro
45
30
 
46
31
  const taro = {
@@ -63,22 +48,7 @@ const taro = {
63
48
  reLaunch,
64
49
  redirectTo,
65
50
  getCurrentPages,
66
- switchTab,
67
- useDidShow,
68
- useDidHide,
69
- usePullDownRefresh,
70
- useReachBottom,
71
- usePageScroll,
72
- useResize,
73
- useShareAppMessage,
74
- useTabItemTap,
75
- useTitleClick,
76
- useOptionMenuClick,
77
- usePullIntercept,
78
- useShareTimeline,
79
- useAddToFavorites,
80
- useReady,
81
- useRouter
51
+ switchTab
82
52
  }
83
53
 
84
54
  const initPxTransform = getInitPxTransform(taro)
@@ -130,20 +100,5 @@ export {
130
100
  reLaunch,
131
101
  redirectTo,
132
102
  getCurrentPages,
133
- switchTab,
134
- useDidShow,
135
- useDidHide,
136
- usePullDownRefresh,
137
- useReachBottom,
138
- usePageScroll,
139
- useResize,
140
- useShareAppMessage,
141
- useTabItemTap,
142
- useTitleClick,
143
- useOptionMenuClick,
144
- usePullIntercept,
145
- useShareTimeline,
146
- useAddToFavorites,
147
- useReady,
148
- useRouter
103
+ switchTab
149
104
  }