Przeglądaj źródła

feat: expose $el while evaluating data expression

Jonas Kuske 5 lat temu
rodzic
commit
c29d372788
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      src/component.js

+ 1 - 1
src/component.js

@@ -17,7 +17,7 @@ export default class Component {
         const dataExpression = dataAttr === '' ? '{}' : dataAttr
         const initExpression = this.$el.getAttribute('x-init')
 
-        this.unobservedData = seedDataForCloning ? seedDataForCloning : saferEval(dataExpression, {})
+        this.unobservedData = seedDataForCloning ? seedDataForCloning : saferEval(dataExpression, { $el: this.$el })
 
         /* IE11-ONLY:START */
             // For IE11, add our magic properties to the original data for access.