D
D
danilr2019-05-27 17:21:15
JavaScript
danilr, 2019-05-27 17:21:15

How to copy mango phone number all over SPA site?

The bottom line is this - there is a mango service, with its own script, which is executed when the SPA page is loaded on the Vue framework.
It makes innerHTML(insert number) one block with certain classes(let it be .mango).
The question is how to properly organize the copying of this number throughout the SPA site in a block with a class (.change)?
ps some elements are removed from the page until you open them (v-if), that is, you need to somehow check when updated (),
and yes, the mango script request to their service can last from 1-5 seconds, that is, setTimeout in Please don't offer a solution. It is necessary to somehow track the appearance of the contents of the block and then uncopy it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-05-27
@danilr

track the appearance of the block content

MutationObserver
This is if the desired block is somehow outside the root element of your application. If inside - do watch on the property responsible for the contents of the block.
UPD. I sketched an example - tracking an external element through MutationObserver, writing a value to Vuex .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question