A
A
Andrew2019-02-16 21:11:27
Vue.js
Andrew, 2019-02-16 21:11:27

How to insert responsive ads in a Vue component?

Can't figure out how to do it. I connected vue-google-adsense, but the whole adaptive immediately floats, since the plugin does not accept all the parameters, which gives adsense. It is impossible to pick it up otherwise - vue swears at the direct embedding of scripts into the template. Or is there a way to put this code in scripts?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grinat, 2019-02-16
@grinat

Make your own directive and paste it to the tag where you want to insert the ad: https://ru.vuejs.org/v2/guide/custom-directive.html
The directive will pass you the home element as soon as it is rendered and you can modify it , insert scripts and generally do whatever you want with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question