콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2205 화면

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
1555
0
9월 23
3492
1
5월 23
2702
2
10월 25
535
1
8월 25
628