petite-vue icon indicating copy to clipboard operation
petite-vue copied to clipboard

Add `$root` refer to component root element

Open ws-rush opened this issue 2 years ago • 0 comments

Some times like in dialogs we need access to root component from child nodes, also it is a way to access root element from v-scope . the next snippet from another PR to expose $el to scope, but this PR can solve the same problem also

<textarea
  v-scope="{width: $root.offsetWidth, height: $root.offsetHeight}"
  @click="width = $el.offsetWidth; height = $el.offsetHeight;"
>
{{ width }} &times; {{ height }}
</textarea>

ws-rush avatar Aug 29 '22 00:08 ws-rush