跳至內容
選單
此問題已被標幟
1 回覆
1998 瀏覽次數

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";


頭像
捨棄
最佳答案

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

頭像
捨棄
作者

i actually did style it using t-ref:

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

apparently this worked

相關帖文 回覆 瀏覽次數 活動
0
1月 25
1019
0
9月 23
2981
1
5月 23
2237
3
10月 23
5211
3
6月 23
4951