zoukankan      html  css  js  c++  java
  • 使用ul标签制作简单的菜单(vue模板)

    先看一下效果图:

    简单粗暴,上代码:

    <template>
        <div class="listMenu-wrap">
            <ul class="list-ul" v-for="(item, index) in data" :key="index">
                <li :class="[currentIndex === index ? 'active' : '']" @click="handleClick(index, item)">{{item}}</li>
            </ul>
        </div>
    </template>
    
    <script>
        export default {
            name: "ListMenu",
            data() {
                return {
                    currentIndex: 0,
                    data:[
                        "项目列表1",
                        "项目列表2",
                        "项目列表3",
                        "项目列表4"
                    ]
                }
            },
            methods: {
                handleClick(index, item) {
                    this.currentIndex = index
                }
            }
        }
    </script>
    
    <style scoped lang="scss">
    .listMenu-wrap{
        .list-ul {
            list-style: none;
            margin: 0;
            padding: 0;
    
            li{
                line-height: 30px;
                font-size: 16px;
                padding: 3px 15px;
    
                &:hover{
                    cursor: pointer;
                    background-color: rgba(69, 86, 118, 0.44);
                    color: #ffffff;
                }
            }
        }
        .active{
            color: #409EFF;
        }
    }
    </style>

    原文链接:https://www.cnblogs.com/yiliangmi/p/15241571.html

  • 相关阅读:
    sap mm_1
    SAP
    tomcat配置
    sap
    数据库范式
    SAP_20140304
    Eclipse 常用设置
    Oracle常用命令1
    Mysql 学习笔记 20140219
    java 宠物商店代码
  • 原文地址:https://www.cnblogs.com/yiliangmi/p/15241571.html
Copyright © 2011-2022 走看看