Skip to content

Commit bdd6d51

Browse files
committed
feat(taro-swan): 修复百度小程序生命周期执行
1 parent 810324e commit bdd6d51

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/taro-swan/src/create-component.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ function bindProperties (weappComponentConf, ComponentClass) {
1919
// 拦截props的更新,插入生命周期
2020
// 调用小程序setData或会造成性能消耗
2121
weappComponentConf.properties[privatePropValName] = {
22-
type: null,
22+
type: Boolean,
23+
value: false,
2324
observer: function () {
2425
if (!this.$component || !this.$component.__isReady) return
2526
const nextProps = filterProps(ComponentClass.properties, ComponentClass.defaultProps, this.$component.props, this.data)
@@ -302,6 +303,9 @@ function createComponent (ComponentClass, isPage) {
302303
this.$component.render = this.$component._createData
303304
this.$component.__propTypes = ComponentClass.propTypes
304305
Object.assign(this.$component.$router.params, options)
306+
if (isPage) {
307+
initComponent.apply(this, [ComponentClass, isPage])
308+
}
305309
},
306310
attached () {
307311
initComponent.apply(this, [ComponentClass, isPage])
@@ -315,7 +319,6 @@ function createComponent (ComponentClass, isPage) {
315319
}
316320
if (isPage) {
317321
weappComponentConf['onLoad'] = weappComponentConf['created']
318-
weappComponentConf['onReady'] = weappComponentConf['ready']
319322
weappComponentConf['onUnload'] = weappComponentConf['detached']
320323
weappComponentConf['onShow'] = function () {
321324
this.$component && this.$component.__mounted && componentTrigger(this.$component, 'componentDidShow')

0 commit comments

Comments
 (0)