V
V
Vanya Huk2017-07-02 18:53:43
JavaScript
Vanya Huk, 2017-07-02 18:53:43

How to run vue.js method on block load?

For example, I have a block

<div onload="foo()">

</div>

how to insert the vue.js method instead of onload="foo()" I will write earlier?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WebDev, 2017-07-02
@vanyahuk

Make this block a component, and put the code from foo() into the mounted() method.

V
Vladimir Zhosan, 2017-07-03
@iaskivsky

Only if you catch it through computed, he asked himself this question, it won’t work through: onload, tk. loop everything.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question