Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the effect of Tab Navigation by vue2.0

Shulou Source: shulou.com Published: 2022-06-01 10:51:33 10月02日 Update

Editor to share with you how vue2.0 to achieve tab navigation effect, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

The details are as follows

1: the background is an e-commerce website on the web side, which presents different kinds of goods according to the navigation tab clicked. First of all, my routing structure is that navigation is a component, and the content of the tab is a separate component.

This is the content of the navigation component. Here, the navigation is mainly generated through the v-for loop. There is nothing to say. It is important to note that because the tab needs to know which module the user clicked on, there is a typeId attribute in the data. Here, you need to pass the value of this property to the tab component.

{{nav.title}} export default {data () {return {navs: [{title: "Home", path:'/home/second', typeId:'1', className:'currLi'} {title: "men's wear", path:'/home/second', typeId:'2'}, {title: "women's wear", path:'/home/second', typeId:'3'} {title: "Children's clothing", path:'/home/second', typeId:'4'}]}}, methods: {seeClothes (event) {var el=event.currentTarget Var type=el.getAttribute ("id"); var a = []; var p = el [XSS _ clean] .children; for (var I = 0meme pl= p.

Tags: Navigation elements occupations suits components professional sets routing time content sexy methods plaid shirts black events women attributes data stripes short skirts Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn OPPO Reno Apple Redmi