1

I used like this in angularjs before. And now I m moving to Vuejs.
How can it be replaced in Vuejs?

 angular.element(document.querySelector('.popup-inner#company-etc')).css('display', 'none');
1
  • 3
    Using DOM like in jQuery was a bad practice in AngularJS, so it is in Vue. Commented Jul 16, 2019 at 12:14

1 Answer 1

1

You can use $refs

<div ref="companyEtc" class="popup-inner" ...

...

this.$refs.companyEtc.style.display = "none"

I would advise to use conditional rendering: https://v2.vuejs.org/v2/guide/conditional.html

You also can find more information about getting element in a component in answers to the question: Vue.js getting an element within a component

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.