-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alita): 添加decorators转化支持,添加mobx处理逻辑,添加mobx样例
- Loading branch information
1 parent
5ee22b0
commit 0b56326
Showing
132 changed files
with
9,763 additions
and
1,039 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,58 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}) | ||
} else { | ||
obj[key] = value | ||
} | ||
return obj | ||
} | ||
|
||
import React, { HocComponent, h } from "@areslabs/wx-react" | ||
export default function(WrappedComponent) { | ||
return class Hoc1 extends HocComponent { | ||
state = { | ||
name: "y5g" | ||
} | ||
var _temp | ||
|
||
componentDidMount() { | ||
console.log("Hoc1 componentDidMount") | ||
} | ||
return ( | ||
(_temp = class Hoc1 extends HocComponent { | ||
constructor(...args) { | ||
super(...args) | ||
|
||
componentWillUnmount() { | ||
console.log("Hoc1 componentWillUnmount") | ||
} | ||
_defineProperty(this, "state", { | ||
name: "y5g" | ||
}) | ||
} | ||
|
||
render() { | ||
return React.createElement(WrappedComponent, { | ||
...this.props, | ||
name: this.state.name, | ||
changeName: newName => { | ||
this.setState({ | ||
name: newName | ||
}) | ||
}, | ||
...this.hocProps | ||
}) | ||
} | ||
} | ||
componentDidMount() { | ||
console.log("Hoc1 componentDidMount") | ||
} | ||
|
||
componentWillUnmount() { | ||
console.log("Hoc1 componentWillUnmount") | ||
} | ||
|
||
render() { | ||
return React.createElement( | ||
WrappedComponent, | ||
Object.assign( | ||
{}, | ||
this.props, | ||
{ | ||
name: this.state.name, | ||
changeName: newName => { | ||
this.setState({ | ||
name: newName | ||
}) | ||
} | ||
}, | ||
this.hocProps | ||
) | ||
) | ||
} | ||
}), | ||
_temp | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.