瀏覽代碼

Evaluate expression in the context of the element

Caleb Porzio 4 年之前
父節點
當前提交
230fb3c11a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      packages/alpinejs/src/directives/x-transition.js

+ 2 - 2
packages/alpinejs/src/directives/x-transition.js

@@ -5,8 +5,8 @@ import { directive } from '../directives'
 import { mutateDom } from '../mutation'
 import { once } from '../utils/once'
 
-directive('transition', (el, { value, modifiers, expression }) => {
-    if (typeof expression === 'function') expression = expression()
+directive('transition', (el, { value, modifiers, expression }, { evaluate }) => {
+    if (typeof expression === 'function') expression = evaluate(expression)
 
     if (! expression) {
         registerTransitionsFromHelper(el, modifiers, value)