Explorar el Código

fix: expose $el while evaluating changed x-data

Jonas Kuske hace 5 años
padre
commit
a01845b25e
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/component.js

+ 1 - 1
src/component.js

@@ -340,7 +340,7 @@ export default class Component {
                 if (! (closestParentComponent && closestParentComponent.isSameNode(this.$el))) continue
 
                 if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'x-data') {
-                    const rawData = saferEval(mutations[i].target.getAttribute('x-data'), {})
+                    const rawData = saferEval(mutations[i].target.getAttribute('x-data'), { $el: this.$el })
 
                     Object.keys(rawData).forEach(key => {
                         if (this.$data[key] !== rawData[key]) {