Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1943 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

i actually did style it using t-ref:

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

apparently this worked

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 25
993
0
thg 9 23
2932
1
thg 5 23
2208
3
thg 10 23
5175
3
thg 6 23
4937