vue实现侧边折叠菜单栏手风琴效果

简介: 该文章介绍了如何使用Vue.js实现具有手风琴效果的侧边折叠菜单栏,包括HTML结构设计、CSS样式设置以及JavaScript交互逻辑的编写。

在我们做管理后台亦或是产品流程时,总是需要一个菜单栏或者导航栏来架起我们的产品架构,那么,如何用vue实现侧边折叠导航栏呢?接下来将一一介绍。

                                   请先看效果演示图。

步骤1:先架构整个页面的布局,撰写html、css和js
HTML代码

<template>
    <div id="main">
        <div class="content">
            <!-- 左边导航栏 -->
            <div class="admin_nav col-lg-3 col-xl-2" v-show="fullWidth">
                <div class = "admin_nav_site">
                    <div class="title">
                        数据中心后台管理
                    </div>
                    <ul v-for="(item,index) in navList" :key="index">
                        <li @click="handleToTitle(index,item)" @mouseenter="changeTitleColor(index)" @mouseleave="removeTitleColor(index)"
                         ref="title" :class="{active:currentSort == index}" class="col-lg-12">
                            <div class="left_icon">
                                <i :class="'iconfont '+item.className"></i>
                            </div>
                            <div class="middle">
                                {
  {item.title}}
                            </div>
                            <div class="right_icon">
                                <i :class="'iconfont '+item.close"></i>
                            </div>
                        </li>
                        <li v-for="(it,idx) in item.secMenu" :key="idx" v-show="item.isSubShow" class="active1">
                            <router-link :to="it.path" tag="a">{
  {it.name}}</router-link>
                        </li>
                    </ul>
                </div>

            </div>
            <!-- 右边内容 -->
            <div class="admin_content col-12 col-md-12 col-lg-12 col-xl-10">
                <div class="admin_header">
                    <!-- 导航图标 -->
                    <div class="H5_item" v-show="!fullWidth">
                        <i class="iconfont icon-daohanglan" @click="make_menu" class-name="H5-menu"></i>
                    </div>
                    <div class="user">
                        <div class="userHead">
                            <span>
                                <img src="../../assets/image/userhead.svg">
                            </span>
                            <span>admin</span>
                        </div>
                        <div class="logOut">
                            <i class="iconfont icon-tuichu"></i>
                        </div>
                    </div>
                </div>
                <div class="admin_body">
                    <keep-alive>
                        <router-view />
                    </keep-alive>
                </div>
            </div>

        </div>


    </div>
</template>

JS代码

<script>
    import axios from 'axios';

    export default {
   
        name: 'navigation',
        data() {
   
            return {
   
                navList: [{
   
                        title: '用户管理',
                        isSubShow: false,
                        className: 'icon-guanliyuan1',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [
                            {
   
                            name: '工号管理',
                            path: '/home/navigation-one/user'
                            }, 
                            // {
   
                            // name: '角色管理',
                            // path: '/home/navigation-one/role'
                            // }, 
                            // {
   
                            // name: '权限管理',
                            // path: '/home/navigation-one/user'
                            // }, 
                        ]


                    },
                    {
   
                        title: '资源管理',
                        isSubShow: false,
                        className: 'icon-ziyuan',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [
                            {
   
                                name: '我的收藏',
                                path: '/home/navigation-one/user'
                            },
                            {
   
                                name: '我的项目',
                                path: '/home/navigation-one/role'
                            }
                        ]

                    },
                    {
   
                        title: '综合管理',
                        isSubShow: false,
                        className: 'icon-zonghe',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [{
   
                                name: '划配管理',
                                path: '/home/navigation-one/user'
                            },
                            {
   
                                name: '数据信息',
                                path: '/home/navigation-one/role'
                            }
                        ]

                    },
                    {
   
                        title: '系统消息',
                        isSubShow: false,
                        className: 'icon-xiaoxi',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [{
   
                                name: '实时动态',
                                path: '/home/navigation-one/user'
                            },
                            {
   
                                name: '过去动态',
                                path: '/home/navigation-one/role'
                            }
                        ]
                    }
                ],
                currentSort: 0,
                pagetype: "index",
                fullWidth: true,
                dismenu: true
            }
        },
        methods: {
   
            active(index) {
   
                this.currentSort = index;
            },
            changeTitleColor(index) {
   
                this.currentSort = index;
            },
            removeTitleColor(index) {
   
                this.currentSort = null;
            },
            handleToTitle(ind, item) {
   
                this.navList[ind].isSubShow = !this.navList[ind].isSubShow;
                if (this.navList[ind].isSubShow == true) {
   
                    this.navList[ind].close = 'icon-zhedie';
                } else {
   
                    this.navList[ind].close = 'icon-close';
                }
            }
        }

    }
</script>

CSS代码

    #main {
   
        background: #F0F6FF;
        font-size: 0.16rem;
    }

    #main .content {
   
        display: flex;
        flex-direction: row;
    }

    .content .admin_nav {
   
        min-height: 9.37rem;
        max-height: 1.3rem;
        padding: 0 !important;
        background: #364150;
        position: relative;

    }

    .content .admin_nav .admin_nav_site{
   
        height: 100vh;
    }

    .content .admin_nav .title {
   
        height: 1.39rem;
        line-height: 1.39rem;
        background: rgba(63, 73, 86, 1);
        color: #FFFFFF;
        text-align: center;
        font-size: 0.18rem;
        display: flex;
        justify-content: center;
    }

    .content .admin_nav .title div {
   
        padding: 0 0.03rem;
    }

    .content .admin_nav .title div:first-child i {
   
        font-size: 0.18rem;
    }

    .content .admin_nav ul .active {
   
        background: rgba(68, 81, 99, 1);
    }

    .content .admin_nav ul .active1 a.router-link-active {
   
        color: #fff;
    }

    .content .admin_nav ul li {
   
        height: 0.6rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 0.18rem;
    }

    .content .admin_nav ul li a {
   
        color: #cecdc5;
        cursor: pointer;
    }

    .content .admin_nav ul li:first-child {
   
        font-size: 0.2rem;
        height: 0.64rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        color: #BEC5C0;
        cursor: pointer;
    }

    .content .admin_nav ul li:first-child div {
   
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #BEC5C0;
    }

    .content .admin_nav ul li:first-child .left_icon {
   
        width: 22%;
    }

    .content .admin_nav ul li:first-child .left_icon i {
   
        color: #1296DB;
    }

    .content .admin_nav ul li:first-child .middle {
   
        width: 56%;
        display: flex;
        justify-content: flex-start;
    }

    .content .admin_nav ul li:first-child .right_icon {
   
        width: 22%;
    }

    .admin_nav .admin .middle:hover {
   
        color: #fff;
    }

    .admin_nav .admin .right_icon i:hover {
   
        color: #fff;
    }

    .admin_nav .admin .middle.router-link-active {
   
        color: #fff;
    }

    .content .admin_nav_position {
   
        position: absolute;
        z-index: 3000;
    }

    .content .admin_content {
   
        padding: 0 !important;
    }

    .content .admin_content .admin_header {
   
        width: 100%;
        height: 0.6rem;
        background: #364150;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .content .admin_content .admin_header .H5_item {
   
        width: 0.4rem;
        height: 0.4rem;
        border-radius: 0.2rem;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-left: 0.2rem;
    }

    .content .admin_content .admin_header .H5_item i {
   
        font-size: 0.22rem;
        color: #fff;
    }

    .content .admin_content .admin_header .user {
   
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .content .admin_content .admin_header .user .userHead {
   
        height: 0.6rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        color: #fff;
        font-size: 0.18rem;
    }

    .content .admin_content .admin_header .user .userHead span {
   
        padding: 0 0.05rem;
    }

    .content .admin_content .admin_header .user .userHead span:nth-child(1) {
   
        position: relative;
    }

    .content .admin_content .admin_header .user .userHead span img {
   
        width: 0.4rem;
        height: 0.4rem;
        border-radius: 50%;
    }

    .content .admin_content .admin_header .user .userHead span input {
   
        width: 0.4rem;
        height: 0.4rem;
        position: absolute;
        overflow: hidden;
        opacity: 0;
        cursor: pointer;
    }

    .content .admin_content .admin_header .user .logOut {
   
        color: #fff;
        margin-left: 0.12rem;
        margin-right: 0.5rem;
    }

    .content .admin_content .admin_header .user .logOut i {
   
        color: #1296DB;
        font-size: 0.24rem;
        cursor: pointer;
    }

    .toggle-cart-enter-active {
   
        transition: all 0.4s linear;
    }

    .toggle-cart-leave-active {
   
        transition: all 0.4s linear;
    }

    .toggle-cart-enter {
   
        transform: translateX(-200%);
    }

    .toggle-cart-leave-active {
   
        transform: translateX(-200%);
    }

步骤2:撰写完基本网页布局和样式后,对部分细节进行剖析。

1、动态绑定路径

<router-link :to="it.path" tag="a">{
   {
   it.name}}</router-link>

2、一级菜单,标题及折叠符号

①通过@mouseenter和@mouseleave事件,当鼠标移入和移出时,改变标题区域背景颜色

②通过@click事件,当鼠标点击时,显示二级菜单列表

③利用:class动态绑定类名,触发active方法,修改折叠符号状态;绑定图标类名,通过遍历,修改对应图标

<ul v-for="(item,index) in navList" :key="index">
    <li @click="handleToTitle(index,item)" @mouseenter="changeTitleColor(index)" @mouseleave="removeTitleColor(index)" ref="title" :class="{active:currentSort == index}" class="col-lg-12">
        <div class="left_icon">
            <i :class="'iconfont '+item.className"></i>
        </div>
        <div class="middle">
            {
  {item.title}}
        </div>
        <div class="right_icon">
            <i :class="'iconfont '+item.close"></i>
        </div>
    </li>
    <li v-for="(it,idx) in item.secMenu" :key="idx" v-show="item.isSubShow" class="active1">
        <router-link :to="it.path" tag="a">{
  {it.name}}</router-link>
    </li>
</ul>
active(index) {
   
    this.currentSort = index;
},

changeTitleColor(index) {
   
    this.currentSort = index;
},

removeTitleColor(index) {
   
    this.currentSort = null;
},

handleToTitle(ind, item) {
   
    this.navList[ind].isSubShow = !this.navList[ind].isSubShow;
    if (this.navList[ind].isSubShow == true) {
   
        this.navList[ind].close = 'icon-zhedie';
    } else {
   
        this.navList[ind].close = 'icon-close';
    }
}

步骤3:菜单栏完成后,在网页端能进行查看,但是还需做一个手机端适配,这样就达到两端同步适应的效果。实现如下:

①对左边导航栏再撰写第二套代码,并绑定好对应的参数实现显示和隐藏

②运用vue已有的transition,绑定name值,实现动画效果绑定

HTML代码

<!-- 移动端导航栏 -->
<transition name="toggle-cart">
    <div class="admin_nav admin_nav_position col-8 col-md-5 col-lg-3 col-xl-3" v-show="!fullWidth&&!dismenu">
        <div class="title">
            <div v-show="!fullWidth">
                <i class="iconfont icon-daohanglan" @click="make_menu" class-name="H5-menu"></i>
            </div>
            <div>数据中心后台管理</div>
        </div>
        <ul v-for="(item,index) in navList" :key="index">
            <li @click="handleToTitle(index,item)" @mouseenter="changeTitleColor(index)" @mouseleave="removeTitleColor(index)" ref="title" :class="{active:currentSort == index}">
                <div class="left_icon">
                    <i :class="'iconfont '+item.className"></i>
                </div>
                <div class="middle">
                    {
  {item.title}}
                </div>
                <div class="right_icon">
                    <i :class="'iconfont '+item.close"></i>
                </div>
            </li>
            <li v-for="(it,idx) in item.secMenu" :key="idx" v-show="item.isSubShow" class="active1">
                <router-link :to="it.path" tag="a">{
  {it.name}}</router-link>
            </li>
        </ul>
    </div>
</transition>

JS代码

mounted() {
   
    window.onresize = () => {
    //监听屏幕变化
        this.page_width();
    };
    this.page_width();
},
methods: {
   
    make_menu() {
    //点击导航图标
        this.dismenu = !this.dismenu;
    },
    page_width() {
    //获取屏幕宽度
        var screenWidth = window.screen.width;
        if (screenWidth <= 1024) {
   
            this.fullWidth = false;
        } else {
   
            this.fullWidth = true;
        }
    }
}

最后来看下手机端效果:

附上全文代码:

<template>
    <div id="main">
        <div class="content">
            <!-- 左边导航栏 -->
            <div class="admin_nav col-lg-3 col-xl-2" v-show="fullWidth">
                <div class = "admin_nav_site">
                    <div class="title">
                        数据中心后台管理
                    </div>
                    <ul v-for="(item,index) in navList" :key="index">
                        <li @click="handleToTitle(index,item)" @mouseenter="changeTitleColor(index)" @mouseleave="removeTitleColor(index)"         
                        ref="title" :class="{active:currentSort == index}" class="col-lg-12">
                            <div class="left_icon">
                                <i :class="'iconfont '+item.className"></i>
                            </div>
                            <div class="middle">
                                {
   {
   item.title}}
                            </div>
                            <div class="right_icon">
                                <i :class="'iconfont '+item.close"></i>
                            </div>
                        </li>
                        <li v-for="(it,idx) in item.secMenu" :key="idx" v-show="item.isSubShow" class="active1">
                            <router-link :to="it.path" tag="a">{
   {
   it.name}}</router-link>
                        </li>
                    </ul>
                </div>

                <!-- 管理员端 -->
                <!-- <ul class="admin">
                    <li class="col-lg-12">
                        <div class="left_icon">
                            <i class="iconfont icon-guanliyuan1"></i>
                        </div>
                        <router-link to="/admin/administrator/secadmin" tag="div" class="middle">管理员端</router-link>
                        <div class="right_icon">
                            <i class="iconfont icon-jinru"></i>
                        </div>
                    </li>
                </ul> -->
            </div>
            <!-- 右边内容 -->
            <div class="admin_content col-12 col-md-12 col-lg-12 col-xl-10">
                <div class="admin_header">
                    <!-- 导航图标 -->
                    <div class="H5_item" v-show="!fullWidth">
                        <i class="iconfont icon-daohanglan" @click="make_menu" class-name="H5-menu"></i>
                    </div>
                    <div class="user">
                        <div class="userHead">
                            <span>
                                <img src="../../assets/image/userhead.svg">
                            </span>
                            <span>admin</span>
                        </div>
                        <div class="logOut">
                            <i class="iconfont icon-tuichu"></i>
                        </div>
                    </div>
                </div>
                <div class="admin_body">
                    <keep-alive>
                        <router-view />
                    </keep-alive>
                </div>
            </div>
            <!-- 移动端导航栏 -->
            <transition name="toggle-cart">
                <div class="admin_nav admin_nav_position col-8 col-md-5 col-lg-3 col-xl-3" v-show="!fullWidth&&!dismenu">
                    <div class="title">
                        <div v-show="!fullWidth">
                            <i class="iconfont icon-daohanglan" @click="make_menu" class-name="H5-menu"></i>
                        </div>
                        <div>数据中心后台管理</div>
                    </div>
                    <ul v-for="(item,index) in navList" :key="index">
                        <li @click="handleToTitle(index,item)" @mouseenter="changeTitleColor(index)" @mouseleave="removeTitleColor(index)"
                         ref="title" :class="{active:currentSort == index}">
                            <div class="left_icon">
                                <i :class="'iconfont '+item.className"></i>
                            </div>
                            <div class="middle">
                                {
   {
   item.title}}
                            </div>
                            <div class="right_icon">
                                <i :class="'iconfont '+item.close"></i>
                            </div>
                        </li>
                        <li v-for="(it,idx) in item.secMenu" :key="idx" v-show="item.isSubShow" class="active1">
                            <router-link :to="it.path" tag="a">{
   {
   it.name}}</router-link>
                        </li>
                    </ul>
                </div>
            </transition>
        </div>
    </div>
</template>

<script>
    import axios from 'axios';

    export default {
   
        name: 'navigation-1',
        data() {
   
            return {
   
                token: '',
                navList: [{
   
                        title: '用户管理',
                        isSubShow: false,
                        className: 'icon-guanliyuan1',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [
                            {
   
                            name: '工号管理',
                            path: '/home/navigation-one/user'
                            }, 
                            // {
   
                            // name: '角色管理',
                            // path: '/home/navigation-one/role'
                            // }, 
                            // {
   
                            // name: '权限管理',
                            // path: '/home/navigation-one/user'
                            // }, 
                        ]


                    },
                    {
   
                        title: '资源管理',
                        isSubShow: false,
                        className: 'icon-ziyuan',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [
                            {
   
                                name: '我的收藏',
                                path: '/home/navigation-one/user'
                            },
                            {
   
                                name: '我的项目',
                                path: '/home/navigation-one/role'
                            }
                        ]

                    },
                    {
   
                        title: '综合管理',
                        isSubShow: false,
                        className: 'icon-zonghe',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [{
   
                                name: '划配管理',
                                path: '/home/navigation-one/user'
                            },
                            {
   
                                name: '数据信息',
                                path: '/home/navigation-one/role'
                            }
                        ]

                    },
                    {
   
                        title: '系统消息',
                        isSubShow: false,
                        className: 'icon-xiaoxi',
                        close: 'icon-close',
                        up: 'icon-zhedie',
                        secMenu: [{
   
                                name: '实时动态',
                                path: '/home/navigation-one/user'
                            },
                            {
   
                                name: '过去动态',
                                path: '/home/navigation-one/role'
                            }
                        ]
                    }
                ],
                currentSort: 0,
                pagetype: "index",
                fullWidth: true,
                dismenu: true
            }
        },
        mounted() {
   
            window.onresize = () => {
    //监听屏幕变化
                this.page_width();
            };
            this.page_width();
        },
        methods: {
   
            active(index) {
   
                this.currentSort = index;
            },
            changeTitleColor(index) {
   
                this.currentSort = index;
            },
            removeTitleColor(index) {
   
                this.currentSort = null;
            },
            handleToTitle(ind, item) {
   
                this.navList[ind].isSubShow = !this.navList[ind].isSubShow;
                if (this.navList[ind].isSubShow == true) {
   
                    this.navList[ind].close = 'icon-zhedie';
                } else {
   
                    this.navList[ind].close = 'icon-close';
                }
            },
            make_menu() {
    //点击导航图标
                this.dismenu = !this.dismenu;
            },
            page_width() {
    //获取屏幕宽度
                var screenWidth = window.screen.width;
                if (screenWidth <= 1024) {
   
                    this.fullWidth = false;
                } else {
   
                    this.fullWidth = true;
                }
            }
        }

    }
</script>

<style scoped>
    #main {
   
        background: #F0F6FF;
        font-size: 0.16rem;
    }

    #main .content {
   
        display: flex;
        flex-direction: row;
    }

    .content .admin_nav {
   
        min-height: 9.37rem;
        max-height: 1.3rem;
        padding: 0 !important;
        background: #364150;
        position: relative;

    }

    .content .admin_nav .admin_nav_site{
   
        height: 100vh;
    }

    .content .admin_nav .title {
   
        height: 1.39rem;
        line-height: 1.39rem;
        background: rgba(63, 73, 86, 1);
        color: #FFFFFF;
        text-align: center;
        font-size: 0.18rem;
        display: flex;
        justify-content: center;
    }

    .content .admin_nav .title div {
   
        padding: 0 0.03rem;
    }

    .content .admin_nav .title div:first-child i {
   
        font-size: 0.18rem;
    }

    .content .admin_nav ul .active {
   
        background: rgba(68, 81, 99, 1);
    }

    .content .admin_nav ul .active1 a.router-link-active {
   
        color: #fff;
    }

    .content .admin_nav ul li {
   
        height: 0.6rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 0.18rem;
    }

    .content .admin_nav ul li a {
   
        color: #cecdc5;
        cursor: pointer;
    }

    .content .admin_nav ul li:first-child {
   
        font-size: 0.2rem;
        height: 0.64rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        color: #BEC5C0;
        cursor: pointer;
    }

    .content .admin_nav ul li:first-child div {
   
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #BEC5C0;
    }

    .content .admin_nav ul li:first-child .left_icon {
   
        width: 22%;
    }

    .content .admin_nav ul li:first-child .left_icon i {
   
        color: #1296DB;
    }

    .content .admin_nav ul li:first-child .middle {
   
        width: 56%;
        display: flex;
        justify-content: flex-start;
    }

    .content .admin_nav ul li:first-child .right_icon {
   
        width: 22%;
    }

    .admin_nav .admin .middle:hover {
   
        color: #fff;
    }

    .admin_nav .admin .right_icon i:hover {
   
        color: #fff;
    }

    .admin_nav .admin .middle.router-link-active {
   
        color: #fff;
    }

    .content .admin_nav_position {
   
        position: absolute;
        z-index: 3000;
    }

    .content .admin_content {
   
        padding: 0 !important;
    }

    .content .admin_content .admin_header {
   
        width: 100%;
        height: 0.6rem;
        background: #364150;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .content .admin_content .admin_header .H5_item {
   
        width: 0.4rem;
        height: 0.4rem;
        border-radius: 0.2rem;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-left: 0.2rem;
    }

    .content .admin_content .admin_header .H5_item i {
   
        font-size: 0.22rem;
        color: #fff;
    }

    .content .admin_content .admin_header .user {
   
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .content .admin_content .admin_header .user .userHead {
   
        height: 0.6rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        color: #fff;
        font-size: 0.18rem;
    }

    .content .admin_content .admin_header .user .userHead span {
   
        padding: 0 0.05rem;
    }

    .content .admin_content .admin_header .user .userHead span:nth-child(1) {
   
        position: relative;
    }

    .content .admin_content .admin_header .user .userHead span img {
   
        width: 0.4rem;
        height: 0.4rem;
        border-radius: 50%;
    }

    .content .admin_content .admin_header .user .userHead span input {
   
        width: 0.4rem;
        height: 0.4rem;
        position: absolute;
        overflow: hidden;
        opacity: 0;
        cursor: pointer;
    }

    .content .admin_content .admin_header .user .logOut {
   
        color: #fff;
        margin-left: 0.12rem;
        margin-right: 0.5rem;
    }

    .content .admin_content .admin_header .user .logOut i {
   
        color: #1296DB;
        font-size: 0.24rem;
        cursor: pointer;
    }

    .toggle-cart-enter-active {
   
        transition: all 0.4s linear;
    }

    .toggle-cart-leave-active {
   
        transition: all 0.4s linear;
    }

    .toggle-cart-enter {
   
        transform: translateX(-200%);
    }

    .toggle-cart-leave-active {
   
        transform: translateX(-200%);
    }
</style>

注:

1、css样式中的rem换算成px为对应的rem值*100,如:font-size:0.24rem;=> font-size:24px;

2、文章中涉及到的iconfont类名是因为引用了阿里图标,如遇到不知道如何引用的可以翻阅博文→ [https://developer.aliyun.com/article/1613119)

3、关于router-link对应的跳转,如有小伙伴不太清楚如何使用vue-router配置路由的可以翻阅博文→[https://developer.aliyun.com/article/1613120)

Ending(〃'▽'〃)!

相关文章
|
28天前
|
JavaScript API 开发者
Vue是如何进行组件化的
Vue是如何进行组件化的
|
1月前
|
JavaScript 前端开发 开发者
vue 数据驱动视图
总之,Vue 数据驱动视图是一种先进的理念和技术,它为前端开发带来了巨大的便利和优势。通过理解和应用这一特性,开发者能够构建出更加动态、高效、用户体验良好的前端应用。在不断发展的前端领域中,数据驱动视图将继续发挥重要作用,推动着应用界面的不断创新和进化。
|
4天前
|
JavaScript 关系型数据库 MySQL
基于VUE的校园二手交易平台系统设计与实现毕业设计论文模板
基于Vue的校园二手交易平台是一款专为校园用户设计的在线交易系统,提供简洁高效、安全可靠的二手商品买卖环境。平台利用Vue框架的响应式数据绑定和组件化特性,实现用户友好的界面,方便商品浏览、发布与管理。该系统采用Node.js、MySQL及B/S架构,确保稳定性和多功能模块设计,涵盖管理员和用户功能模块,促进物品循环使用,降低开销,提升环保意识,助力绿色校园文化建设。
|
28天前
|
JavaScript 前端开发 开发者
Vue是如何劫持响应式对象的
Vue是如何劫持响应式对象的
26 1
|
28天前
|
JavaScript 前端开发 API
介绍一下Vue中的响应式原理
介绍一下Vue中的响应式原理
31 1
|
28天前
|
JavaScript 前端开发 开发者
Vue是如何进行组件化的
Vue是如何进行组件化的
|
28天前
|
存储 JavaScript 前端开发
介绍一下Vue的核心功能
介绍一下Vue的核心功能
|
1月前
|
JavaScript 前端开发 开发者
vue学习第一章
欢迎来到我的博客!我是瑞雨溪,一名热爱前端的大一学生,专注于JavaScript与Vue,正向全栈进发。博客分享Vue学习心得、命令式与声明式编程对比、列表展示及计数器案例等。关注我,持续更新中!🎉🎉🎉
36 1
vue学习第一章
|
1月前
|
JavaScript 前端开发 索引
vue学习第三章
欢迎来到瑞雨溪的博客,一名热爱JavaScript与Vue的大一学生。本文介绍了Vue中的v-bind指令,包括基本使用、动态绑定class及style等,希望能为你的前端学习之路提供帮助。持续关注,更多精彩内容即将呈现!🎉🎉🎉
27 1
vue学习第三章
|
1月前
|
缓存 JavaScript 前端开发
vue学习第四章
欢迎来到我的博客!我是瑞雨溪,一名热爱JavaScript与Vue的大一学生。本文介绍了Vue中计算属性的基本与复杂使用、setter/getter、与methods的对比及与侦听器的总结。如果你觉得有用,请关注我,将持续更新更多优质内容!🎉🎉🎉
35 1
vue学习第四章