Bläddra i källkod

fix: expose $el while evaluating changed x-data

Jonas Kuske 5 år sedan
förälder
incheckning
a01845b25e
1 ändrade filer med 1 tillägg och 1 borttagningar
  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]) {