V
V
VctorIAN2021-06-30 11:34:17
Vue.js
VctorIAN, 2021-06-30 11:34:17

Is it possible to create a directive like v-widthAsChild.tovmin()?

Hello, I need something like an additional method to the directive, almost like a prototype, that is, without the tovmin method, the directive will set the width of the element to the width of the child using

el.style.width = getComputedStyle(el.firstChild).getPropertyValue(
        "width"
      );

but when calling the tovmin() method, the directive will set
el.style.width = 100 * parseInt( getComputedStyle(el.firstChild).getPropertyValue(
        "width"
      ) ) / getMinSide() + "vmin";

How can I do this or something similar?

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