In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to customize the right-click menu in vue. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.
1. On the page where you need to add the right button, bind the contextmenu event (block browser default events, add custom events)
....
two。 Write the contents of the right-click menu on the page
Add node add node
3. Define the required variable attributes in data ()
Data () {return {visible: false, top: 0, left: 0}}
4. Create a listening event to trigger a method to close the right-click menu
Watch: {visible (value) {if (value) {document.body.addEventListener ('click', this.closeMenu)} else {document.body.removeEventListener (' click', this.closeMenu)}
5. Two ways to open and close right-click menus
/ / startopenMenu (e) {var x = e.pageX; var y = e.pageY; this.top = y; this.left = x; this.visible = true;// controls the opening of the right-click menu here}, / / closecloseMenu () {this.visible = false;}
6. Style
.contextmenu {margin: 0; background: # fff; z-index: 3000; position: absolute; list-style-type: none; padding: 5px 0; border-radius: 4px; font-size: 12px; font-weight: 400; color: # 333; box-shadow: 2px 2px 3px 0 rgba (0,0,0,0.3);} .contextmenu li {margin: 0; padding: 7px 16px; cursor: pointer;}. Contextmenu li:hover {background: # eee } these are all the contents of the article "how to customize the right-click menu in vue". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.