Browse Source

Ensure event object is passed to handlers defined as functions using x-spread

Mark Perkins 5 năm trước cách đây
mục cha
commit
63abce3314
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/utils.js

+ 1 - 1
src/utils.js

@@ -59,7 +59,7 @@ export function debounce(func, wait) {
 
 export function saferEval(expression, dataContext, additionalHelperVariables = {}) {
     if (typeof expression === 'function') {
-        return expression.call(dataContext)
+        return expression.call(dataContext, additionalHelperVariables['$event'])
     }
 
     return (new Function(['$data', ...Object.keys(additionalHelperVariables)], `var __alpine_result; with($data) { __alpine_result = ${expression} }; return __alpine_result`))(