Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime-web): 增加 this.createIntersectionObserver 实现 #92

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(runtime-web): 增加 this.createIntersectionObserver 实现
  • Loading branch information
hwaphon committed Aug 1, 2023
commit af1137243197641e2f3a89183b17b0b3c0227853
20 changes: 10 additions & 10 deletions packages/runtime-web/src/runtime/public/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,18 @@ export class KBComponent extends React.PureComponent<any, IState> {
* 合并props,如果传过来的props value 是undifined 那么就使用defualtProp 替代
*/
const newProps = this.mergeProps(props)
; (this.state as IState).prevProps = (() => {
const keys = Object.keys(this.state.cachePrePropsAction)
const result = { ...newProps, ...this.state.prevProps }
;(this.state as IState).prevProps = (() => {
const keys = Object.keys(this.state.cachePrePropsAction)
const result = { ...newProps, ...this.state.prevProps }

keys.forEach((key) => {
const value = newProps[key]
keys.forEach((key) => {
const value = newProps[key]

if (typeof value === 'object') result[key] = deepCopy(value)
})
if (typeof value === 'object') result[key] = deepCopy(value)
})

return result
})()
return result
})()

// mixin deriveDataFromProps 相关
if (this.componentConfig.deriveDataFromProps) {
Expand Down Expand Up @@ -445,7 +445,7 @@ export class KBComponent extends React.PureComponent<any, IState> {

componentWillUnmount() {
this._isMounted = false
; (this.state as IState).cachePrePropsAction = {}
;(this.state as IState).cachePrePropsAction = {}
this.cachePreDataAction = {}
this.updateDataQueue = []
this.didUnmount()
Expand Down