feat:add pureCallEntityMethod,avoid hook affects
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { jsObtainContext, jsCallEntityMethod } from 'doric/src/runtime/sandbox'
|
||||
import { jsObtainContext, jsCallEntityMethod, pureCallEntityMethod } from 'doric/src/runtime/sandbox'
|
||||
import { Panel } from 'doric'
|
||||
import { DoricPlugin } from "./DoricPlugin"
|
||||
import { createContext, destroyContext } from "./DoricDriver"
|
||||
@@ -39,6 +39,14 @@ export class DoricContext {
|
||||
return Reflect.apply(jsCallEntityMethod, this.panel, argumentsList)
|
||||
}
|
||||
|
||||
pureInvokeEntityMethod(method: string, ...otherArgs: any) {
|
||||
const argumentsList: any = [this.contextId]
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
argumentsList.push(arguments[i])
|
||||
}
|
||||
return Reflect.apply(pureCallEntityMethod, this.panel, argumentsList)
|
||||
}
|
||||
|
||||
init(data?: string) {
|
||||
this.invokeEntityMethod("__init__", data)
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ export class DoricListNode extends DoricSuperNode {
|
||||
onBlended() {
|
||||
super.onBlended()
|
||||
if (this.childNodes.length !== this.itemCount) {
|
||||
const ret = this.callJSResponse("renderBunchedItems", this.childNodes.length, this.itemCount) as DVModel[]
|
||||
const ret = this.pureCallJSResponse("renderBunchedItems", this.childNodes.length, this.itemCount) as DVModel[]
|
||||
this.childNodes = this.childNodes.concat(ret.map(e => {
|
||||
const viewNode = DoricViewNode.create(this.context, e.type) as DoricListItemNode
|
||||
viewNode.viewId = e.id
|
||||
@@ -72,6 +72,9 @@ export class DoricListNode extends DoricSuperNode {
|
||||
if (this.loadMoreViewNode) {
|
||||
this.view.appendChild(this.loadMoreViewNode.view)
|
||||
}
|
||||
if (this.view.scrollTop + this.view.offsetHeight === this.view.scrollHeight) {
|
||||
this.onScrollToEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
blendSubNode(model: DVModel) {
|
||||
|
@@ -311,6 +311,14 @@ export abstract class DoricViewNode {
|
||||
}
|
||||
return Reflect.apply(this.context.invokeEntityMethod, this.context, argumentsList)
|
||||
}
|
||||
|
||||
pureCallJSResponse(funcId: string, ...args: any) {
|
||||
const argumentsList: any = ['__response__', this.getIdList(), funcId]
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
argumentsList.push(arguments[i])
|
||||
}
|
||||
return Reflect.apply(this.context.pureInvokeEntityMethod, this.context, argumentsList)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user