element左侧导航栏

由element组件搭建的左侧导航栏

预览:

html代码:

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <style>
/*<!--        调整页面背景颜色-->*/
        body{
            background-color: #eef1f6;
        }
        .el-row {
            display: flex;
            height: 100vh; /* 设置高度为视口高度 */
        }

        .el-col {
            display: flex;
            flex-direction: column;
        }

        .el-menu {
            flex-grow: 1;
        }
    </style>
</head>
<body>
<div id="app">
    <el-row>
<!--     导航页   -->
        <el-col :span="3">
            <el-menu
                    default-active="0"
                    class="el-menu-vertical-demo"
                    @select="handleSelect"
                    background-color="#303133"
                    text-color="#fff"
                    active-text-color="#ffd04b">
                <h3 style="text-align: center; background-color: yellow">酒店客房管理系统</h3>
                <el-menu-item index="0">首页</el-menu-item>
                <el-submenu index="1">
                    <template slot="title">
                        <span>系统管理</span>
                    </template>
                        <el-menu-item index="1-1">用户管理</el-menu-item>
                        <el-menu-item index="1-2">日志管理</el-menu-item>
                </el-submenu>
                <el-submenu index="2">
                    <template slot="title">
                        <span>报表管理</span>
                    </template>
                    <el-menu-item index="2-1">预定客人报表</el-menu-item>
                    <el-menu-item index="2-2">在线客人报表</el-menu-item>
                    <el-menu-item index="2-3">离店客人报表</el-menu-item>
                    <el-menu-item index="2-4">财务进账报表</el-menu-item>
                </el-submenu>
                <el-submenu index="3">
                    <template slot="title">
                        <span>房客管理</span>
                    </template>
                    <el-menu-item index="3-1">客房预定管理</el-menu-item>
                    <el-menu-item index="3-2">入住登记管理</el-menu-item>
                    <el-menu-item index="3-3">预定转入住</el-menu-item>
                    <el-menu-item index="3-4">换房管理</el-menu-item>
                    <el-menu-item index="3-5">结账管理</el-menu-item>
                </el-submenu>
                <el-submenu index="4">
                    <template slot="title">
                        <span>客房管理</span>
                    </template>
                    <el-menu-item index="4-1">客房信息管理</el-menu-item>
                </el-submenu>
                <el-submenu index="5">
                    <template slot="title">
                        <span>消费管理</span>
                    </template>
                    <el-menu-item index="5-1">附加消费入账</el-menu-item>
                </el-submenu>
                <el-submenu index="6">
                    <template slot="title">
                        <span>基础信息管理</span>
                    </template>
                    <el-menu-item index="6-1">客房类型管理</el-menu-item>
                    <el-menu-item index="6-2">楼层管理</el-menu-item>
                    <el-menu-item index="6-3">商品类别管理</el-menu-item>
                    <el-menu-item index="6-4">商品管理</el-menu-item>
                    <el-menu-item index="6-5">会员管理管理</el-menu-item>
                </el-submenu>
                <el-menu-item index="7">
                    <span><a href="index.html">退出登录</a></span>
                </el-menu-item>
            </el-menu>
        </el-col>
<!--    首页  -->
        <el-col :span="21" v-if="this.page == 0">
            <center><h1>欢迎使用酒店客房管理系统</h1></center>
            <h2>你是{{user.position}}</h2>
        </el-col>
<!--客房管理 -->
        <el-col :span="21" v-if="this.page == '6-1'">
            <h1>客房管理</h1>
            <el-divider></el-divider>
            <el-button style="width: 150px" type="primary" @click="addRoomType()">新增客房类型</el-button>
            <el-table
                    :data="roomTypeTableData"
                    border
                    style="width: 100%">
                <el-table-column
                        type="index"
                        width="100">
                </el-table-column>
                <el-table-column
                        prop="type"
                        label="客房类型"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="capacity"
                        label="额定容量"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="note"
                        label="备注"
                        align="center">
                </el-table-column>
                <el-table-column label="操作" width="200" align="center">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="editRoomType(scope.row)">编辑</el-button>
                        <el-button type="danger" size="mini" @click="deleteRoomType(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-col>
    </el-row>

    <div id="dialog">
<!--     新增客房类型对话框   -->
        <el-dialog title="新增客房类型" :visible.sync="addRoomTypeFormVisible">
            <el-form :model="roomType">
                <el-form-item  label="类型名" label-width="120px" :rules="[{ required: true, message: '请输入客房类型名', trigger: 'blur' }]">
                    <el-input v-model="roomType.type"></el-input>
                </el-form-item>
                <el-form-item label="额定人数" label-width="120px" :rules="[{ required: true, message: '请输入额定人数', trigger: 'blur' }]">
                    <el-input v-model="roomType.capacity"></el-input>
                </el-form-item>
                <el-form-item label="备注" label-width="120px">
                    <el-input type="textarea" v-model="roomType.note"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="addRoomTypeFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="summitRoomType">提 交</el-button>
            </div>
        </el-dialog>

        <el-dialog title="编辑客房类型" :visible.sync="editRoomTypeFormVisible">
            <el-form :model="roomType">
                <el-form-item  label="类型名" label-width="120px" >
                    <el-input v-model="roomType.type"></el-input>
                </el-form-item>
                <el-form-item label="额定人数" label-width="120px">
                    <el-input v-model="roomType.capacity"></el-input>
                </el-form-item>
                <el-form-item label="备注" label-width="120px">
                    <el-input type="textarea" v-model="roomType.note"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="editRoomTypeFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="updateRoomType">确 定</el-button>
            </div>
        </el-dialog>

    </div>

</div>


<script src="js/vue.js"></script>
<script src="js/axios-0.18.0.js"></script>
<script src="element-ui/lib/index.js"></script>
<link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                
        },
        methods: {
            
            handleSelect(key,keyPath){
                this.page = key;
                if(key=='6-1'){
                    this.selectAll();
                }
            }
         
        },
        mounted(){
            this.$message({
                message: '欢迎使用酒店管理系统',
                type: 'success'
            })
        }
    })
</script>
</body>
</html>

需要引入vue.js文件和饿了么组件包,需要文件的话可以去官网获得,也可以加我v : LXY_OvO_

相关推荐
Cachel wood1 小时前
Vue.js前端框架教程5:Vue数据拷贝和数组函数
linux·前端·vue.js·python·阿里云·前端框架·云计算
匹马夕阳1 小时前
防抖(Debounce)和节流(Throttle)的区别和应用场景
开发语言·前端·javascript
冴羽2 小时前
Solid.js 最新官方文档翻译(2)—— 响应式介绍
前端·javascript·react.js
今晚哒老虎2 小时前
ElementPlus Table 表格实现可编辑单元格
javascript·vue.js·elementui
Domain-zhuo2 小时前
uniapp跨端适配—条件编译
前端·javascript·vue.js·uni-app·vue
Cachel wood2 小时前
Vue.js前端框架教程1:Vue应用启动和Vue组件
大数据·前端·vue.js·git·elasticsearch·前端框架·ssh
tester Jeffky2 小时前
Vue简介:构建现代Web应用的前端框架
前端·vue.js·前端框架
Cachel wood2 小时前
Vue.js前端框架教程2:Vue路由和状态管理库Pinia
java·linux·服务器·前端·vue.js·前端框架·github
tester Jeffky3 小时前
JavaScript中的var、let和const:变量声明的演变与最佳实践
javascript