Vue detects the source of updates

I now have a SVG editor component Editor marked as editable element edit-component .
this set of components is used in the following combinations

  <editor>
    <g>
      <edit-component />
      <rect fill="transparent" onClick={this.startEdit} />
    </g>
    <g>
      <edit-component />
      <rect fill="transparent" onClick={this.startEdit} />
    </g>
    <g>
      <edit-component />
      <rect fill="transparent" onClick={this.startEdit} />
    </g>

    <handler-shape />
  </editor>

when rect is clicked, data of editor records the geometric state (wide and high margins) of a component being edited,
and renders a handler-shape component as an adjustment handle before < / editor > closes the tag.
when the user adjusts the handle, I adjust the < code from this.$slots.default in the render method.

when adjusting the handle, the method call that changes the geometric state of the element is from within the component,
but now there is a requirement that this geometric state may also come from the outside.

because when I select a edit-component ,
displays a panel with multiple input to show the geometry of this component.

in addition to dragging the handle, the user can also change the component by entering a numeric value.
means that the external part of the component can update the corresponding handler-shape

by changing the this.$slots.default passed in.

now the problem is that a component can change its data, both internally and externally this.$slots.default to its data,
, so what can I do to identify the source that triggered the data update?

Sep.16,2021

since it is passed from outside to inside, don't change it internally, otherwise you will go against its original intention


according to your requirements, don't change the interior directly, but emit an event to let the outside change


the problem has been solved. External updates basically trigger the component's props , mounted () , beforeDestroy () , monitor these three things, and then notify the parent component to update its data through a method this.$parent.func () defined in advance by the parent component.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb79f3-2672.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb79f3-2672.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?