In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how vue hides elements. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Vue hidden elements of the method: 1, the use of "v-if" instruction, through the dynamic addition or deletion of DOM elements to the DOM tree to show or hide elements; 2, the use of "v-show" directive, by setting the display style attributes of DOM elements to control hidden.
The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.
Vue controls the display and hiding of elements
Solution:
Both v-if instruction and v-show instruction can dynamically control the hiding of DOM elements according to the value. V-if and v-show are commonly used internal instructions of Vue. The duty of the instruction is to apply some special behavior to DOM when the value of the expression changes.
V-if deletes the element directly
V-show is just hidden, simply switching the element's CSS attribute display.
Layer group
For example, if you want to hide the above p, then add a v-show attribute to the p. You can choose any name you want.
Then set the default value of showGroup to false in the js code, that is, when it is started, it is not displayed by default. If you want to display this p later, you can simply set vm.showGroup=true.
Thank you for reading! This is the end of this article on "how to hide elements in vue". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.