S
S
shasoft2019-11-08 09:27:14
JavaScript
shasoft, 2019-11-08 09:27:14

How to react to slot change?

There is a component

<template>
  <pre>
    <slot></slot>
  </pre>
</template>

in the mounted event, I receive its value as this.$el.innerHTML , process it and again assign it to this.$el.innerHTML .
However, if I change the slot, i.e. I output as I change textSlota, then the text is no longer converted, but is displayed "as is". How to finalize the component so that when the textSlota changes, the transformation is called? Some event or maybe my approach is not correct,
<s-component>{{ textSlota }}</s-component>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question