Explorar el Código

feat: expose $el while evaluating data expression

Jonas Kuske hace 5 años
padre
commit
c29d372788
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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.