我以前在angularjs中使用过这种方式。现在我要转到Vuejs。
如何在Vuejs中替换它?
angular.element(document.querySelector('.popup-inner#company-etc')).css('display', 'none');
答案 0 :(得分:1)
您可以使用$refs
<div ref="companyEtc" class="popup-inner" ...
...
this.$refs.companyEtc.style.display = "none"
我建议使用条件渲染:https://vuejs.org/v2/guide/conditional.html
您还可以在以下问题的答案中找到有关在组件中获取元素的更多信息:VueJs getting an element within a component