Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
1971 Weergaven

there is a t-ref="xyz" declared and in JS I reference it using this.rootRef=useRef("xyz")

Now how do I change the styles and attributes of this reference div from js.

 to change the value , I did 

this.rootRef.el.value="custom_value";

but this does not work for styling , I tried

this.rootRef.el.style.display="block";


Avatar
Annuleer
Beste antwoord

Hi,

We cannot style the divs using useREF hooks, if you want to change you can directly use the 

this.$el.find() = class name to apply the styles.
For eg: this.$el.find('button.btn:visible')

Hope it helps

Avatar
Annuleer
Auteur

i actually did style it using t-ref:

this.rootRef=useRef("xyz");
this.rootRef.el.style['display']="block";

apparently this worked

Gerelateerde posts Antwoorden Weergaven Activiteit
0
jan. 25
999
0
sep. 23
2942
1
mei 23
2212
3
okt. 23
5186
3
jun. 23
4942