首页 > 其他分享 >vue 设置 菜单Item 背景色

vue 设置 菜单Item 背景色

时间:2023-03-21 15:56:05浏览次数:35  
标签:vue selected 背景色 Item 菜单 key

 <a-menu-item 
            @click = "selectItem" :class = 'child.id==selected? "selected":""'
            v-for="(child) in item.children" :key="child.id" >


 data () {
      return {
        spinning: false,
        selected:-1
        
      }


methods: {
      async onSelect (e) {
        this.$emit('select', { id: e.key })
      },
      selectItem(e){
        this.selected = e.key
      }


 .selected{
    background-color: aquamarine;
  }

 

标签:vue,selected,背景色,Item,菜单,key
From: https://www.cnblogs.com/bkwf/p/17240299.html

相关文章