chore: modify the function calling
All checks were successful
All checks were successful
This commit is contained in:
parent
0131cab6ac
commit
2c04be8607
|
@ -155,7 +155,7 @@ export default (options: ComponentOptions) => {
|
|||
this._extractStatePathsFromExpression.bind(this),
|
||||
states: this._states,
|
||||
triggerFunc: this.triggerFunc.bind(this),
|
||||
setupArrowFunctionHandler: utils.setupArrowFunctionHandler.bind(this),
|
||||
// setupArrowFunctionHandler: utils.setupArrowFunctionHandler.bind(this),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import parseTemplate from './parseTemplate'
|
||||
import processTemplateMacros from './processTemplateMarco'
|
||||
import processTemplateMacros from './processTemplateMarcos'
|
||||
import setupArrowFunctionHandler from './setupArrowFunctionHandler'
|
||||
import triggerDomUpdates from './triggerDomUpdates'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import setupArrowFunctionHandler from './setupArrowFunctionHandler'
|
||||
|
||||
export default function processTemplateMacros(
|
||||
element: Element,
|
||||
context: CustomElement,
|
||||
|
@ -9,24 +11,6 @@ export default function processTemplateMacros(
|
|||
expr: string,
|
||||
attrValue: string,
|
||||
) => void
|
||||
setupArrowFunctionHandler: (
|
||||
element: Element,
|
||||
eventName: string,
|
||||
handlerValue: string,
|
||||
ops: {
|
||||
createHandlerContext: (
|
||||
event: Event,
|
||||
element: Element,
|
||||
) => {
|
||||
states: Record<string, unknown>
|
||||
stateToElementsMap: Record<string, Set<HTMLElement>>
|
||||
statesListeners: Record<string, (value: unknown) => void>
|
||||
setState: (keyPath: string, value: unknown) => void
|
||||
getState: (keyPath: string) => unknown
|
||||
triggerFunc: (eventName: string, ...args: unknown[]) => void
|
||||
}
|
||||
},
|
||||
) => void
|
||||
setupFunctionCallHandler: (
|
||||
element: Element,
|
||||
eventName: string,
|
||||
|
@ -162,7 +146,7 @@ export default function processTemplateMacros(
|
|||
// Handle different types of event handlers
|
||||
if (handlerValue.includes('=>')) {
|
||||
// Handle arrow function: @click="e => setState('count', count + 1)"
|
||||
options.setupArrowFunctionHandler(
|
||||
setupArrowFunctionHandler(
|
||||
currentElementNode,
|
||||
eventName,
|
||||
handlerValue,
|
Loading…
Reference in New Issue
Block a user