Java阶段三Day05

这篇具有很好参考价值的文章主要介绍了Java阶段三Day05。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Java阶段三Day05

ElementUI

Element,一套为开发者、设计师和产品经理准备的桌面端组件库

官方文档

  • 基于Vue2.x的Element UI文档:Element - 网站快速成型工具
  • 基于Vue3.x的Element UI文档:一个 Vue 3 UI 框架 | Element Plus

组件

开发指南

  • npm安装

    推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用。

    npm i element-ui -S
    
  • CDN

    • 目前可以通过 unpkg.com/element-ui 获取到最新版本的资源,在页面上引入 js 和 css 文件即可开始使用。

      <!-- 引入样式 -->
      <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
      <!-- 引入组件库 -->
      <script src="https://unpkg.com/element-ui/lib/index.js"></script>
      
  • Hello world文章来源地址https://www.toymoban.com/news/detail-459954.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <!-- import CSS -->
            <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
        </head>
        <body>
            <div id="app">
                <el-button @click="visible = true">Button</el-button>
                <el-dialog :visible.sync="visible" title="Hello world">
                    <p>Try Element</p>
                </el-dialog>
            </div>
        </body>
        <!-- import Vue before Element -->
        <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
        <!-- import JavaScript -->
        <script src="https://unpkg.com/element-ui/lib/index.js"></script>
        <script>
            new Vue({
                el: '#app',
                data: function() {
                    return { visible: false }
                }
            })
        </script>
    </html>
    

布局

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
        <style>
            .c1{
                border: 1px solid red;
                border-radius: 5px;
                height: 50px;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <!--总共24分栏, 通过span设置当前列占多少分栏-->
            <el-row>
                <el-col span="12"><div class="c1">111</div></el-col>
                <el-col span="12"><div class="c1">2222</div></el-col>
            </el-row>
            <el-row>
                <el-col span="6"><div class="c1"></div></el-col>
                <el-col span="6"><div class="c1"></div></el-col>
                <el-col span="6"><div class="c1"></div></el-col>
                <el-col span="6"><div class="c1"></div></el-col>
            </el-row>
            <el-row>
                <el-col span="4"><div class="c1"></div></el-col>
                <el-col span="4"><div class="c1"></div></el-col>
                <el-col span="4"><div class="c1"></div></el-col>
                <el-col span="4"><div class="c1"></div></el-col>
                <el-col span="4"><div class="c1"></div></el-col>
                <el-col span="4"><div class="c1"></div></el-col>
            </el-row>
            <!--带有居中效果的2:1两部分-->
            <div style="width: 1200px;margin: 0 auto">
                <el-row gutter="20">
                    <el-col span="16"><div class="c1"></div></el-col>
                    <el-col span="8"><div class="c1"></div></el-col>
                </el-row>
            </div>
            <!--练习1:     1:3:1:1 居中,间距为10个像素-->
            <div style="width: 1200px;margin: 0 auto">
                <el-row gutter="10">
                    <el-col span="4"><div class="c1"></div></el-col>
                    <el-col span="12"><div class="c1"></div></el-col>
                    <el-col span="4"><div class="c1"></div></el-col>
                    <el-col span="4"><div class="c1"></div></el-col>
                </el-row>
            </div>
            <!--练习2:       1:2:3 居中 间距20-->
            <div style="width: 1200px;margin: 0 auto">
                <el-row gutter="20">
                    <el-col span="4"><div class="c1"></div></el-col>
                    <el-col span="8"><div class="c1"></div></el-col>
                    <el-col span="12"><div class="c1"></div></el-col>
                </el-row>
            </div>
            <!--练习3:       8等分 居中 间距5  用v-for  -->
            <div style="width: 1200px;margin: 0 auto">
                <el-row gutter="5">
                    <el-col span="3" v-for="item in 8"><div class="c1">{{item}}</div></el-col>
                </el-row>
            </div>
            <h3>列偏移</h3>
            <el-row>
                <el-col offset="4" span="20"><div class="c1"></div></el-col>
            </el-row>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {

                }
            },
            methods: {

            }
        })
    </script>
</html>

布局容器

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
        <style>
            .el-header{background-color: red;}
            .el-footer{background-color: green}
            .el-main{height: 300px;background-color: blue;}

        </style>
    </head>
    <body>
        <div id="app">
            <el-container>
                <el-header>Header</el-header>
                <el-main>Main</el-main>
                <el-footer>Footer</el-footer>
            </el-container>
            <h1>先上下,再左右</h1>
            <el-container>
                <el-header>Header</el-header>
                <el-container>
                    <el-aside width="200px">Aside</el-aside>
                    <el-main>Main</el-main>
                </el-container>
            </el-container>

            <el-row gutter="10">
                <el-col span="8" v-for="item in 3">
                    <el-card><h1>张三</h1></el-card>
                </el-col>
            </el-row>

        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {

                }
            },
            methods: {

            }
        })
    </script>
</html>

按钮

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">

            <el-row>
                <el-button>默认按钮</el-button>
                <el-button type="primary">主要按钮</el-button>
                <el-button type="success">成功按钮</el-button>
                <el-button type="info">信息按钮</el-button>
                <el-button type="warning">警告按钮</el-button>
                <el-button type="danger">危险按钮</el-button>
            </el-row>

            <el-row>
                <el-button plain>朴素按钮</el-button>
                <el-button type="primary" plain>主要按钮</el-button>
                <el-button type="success" plain>成功按钮</el-button>
                <el-button type="info" plain>信息按钮</el-button>
                <el-button type="warning" plain>警告按钮</el-button>
                <el-button type="danger" plain>危险按钮</el-button>
            </el-row>

            <el-row>
                <el-button round>圆角按钮</el-button>
                <el-button type="primary" round>主要按钮</el-button>
                <el-button type="success" round>成功按钮</el-button>
                <el-button type="info" round>信息按钮</el-button>
                <el-button type="warning" round>警告按钮</el-button>
                <el-button type="danger" round>危险按钮</el-button>
            </el-row>

            <el-row>
                <el-button icon="el-icon-search" circle></el-button>
                <el-button type="primary" icon="el-icon-edit" circle></el-button>
                <el-button type="success" icon="el-icon-check" circle></el-button>
                <el-button type="info" icon="el-icon-message" circle></el-button>
                <el-button type="warning" icon="el-icon-star-off" circle></el-button>
                <el-button type="danger" icon="el-icon-delete" circle></el-button>
            </el-row>
            <h3>自己的按钮</h3>
            <el-button type="success">成功</el-button>
            <el-button type="danger" plain>危险</el-button>
            <el-button type="warning" round>警告</el-button>
            <el-button type="success" circle icon="el-icon-delete"></el-button>
            <h3>不同尺寸按钮</h3>
            <el-button type="success">成功</el-button>
            <el-button type="success" size="medium">成功</el-button>
            <el-button type="success" size="small">成功</el-button>
            <el-button type="success" size="mini">成功</el-button>
            <h3>字体图标</h3>
            <i class="el-icon-edit">编辑</i>
            <i class="el-icon-share" style="font-size: 40px"></i>
            <i class="el-icon-delete" style="color: red"></i>
            <i class="el-icon-chicken"></i>
            <el-button type="primary" icon="el-icon-search">搜索</el-button>

        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {

                }
            },
            methods: {

            }
        })
    </script>
</html>

分割线

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">
            <template>
                <div>
                    <span>青春是一个短暂的美梦, 当你醒来时, 它早已消失无踪</span>
                    <el-divider></el-divider>
                    <hr>
                    <span>少量的邪恶足以抵消全部高贵的品质, 害得人声名狼藉</span>
                </div>
            </template>
            <template>
                <div>
                    <span>头上一片晴天,心中一个想念</span>
                    <el-divider content-position="left">少年包青天</el-divider>
                    <span>饿了别叫妈, 叫饿了么</span>
                    <el-divider><i class="el-icon-mobile-phone"></i></el-divider>
                    <span>为了无法计算的价值</span>
                    <el-divider content-position="right">阿里云</el-divider>
                </div>
            </template>

            <template>
                <div>
                    <span>雨纷纷</span>
                    <el-divider direction="vertical"></el-divider>
                    <span>旧故里</span>
                    <el-divider direction="vertical"></el-divider>
                    <span>草木深</span>
                </div>
            </template>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {

                }
            },
            methods: {

            }
        })
    </script>
</html>

消息提示

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">
            <template>
                <el-button :plain="true" @click="open2">成功</el-button>
                <el-button :plain="true" @click="open3">警告</el-button>
                <el-button :plain="true" @click="open1">消息</el-button>
                <el-button :plain="true" @click="open4">错误</el-button>
            </template>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {

                }
            },
            methods: {
                open1() {
                    this.$message('这是一条消息提示');
                },
                open2() {
                    v.$message.success("成功消息");
                },

                open3() {
                    v.$message.warning("警告");
                },

                open4() {
                    this.$message.error('错了哦,这是一条错误消息');
                }
            }
        })
    </script>
</html>

下拉菜单

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
        <style>
            .el-dropdown-link {
                cursor: pointer;
                color: #409EFF;
            }

            .el-icon-arrow-down {
                font-size: 12px;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <h1>{{info}}</h1>
            <el-dropdown @command="handleCommand">
                <span class="el-dropdown-link">
                    下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item command="黄金糕">黄金糕</el-dropdown-item>
                    <el-dropdown-item command="狮子头">狮子头</el-dropdown-item>
                    <el-dropdown-item command="螺蛳粉">螺蛳粉</el-dropdown-item>
                    <el-dropdown-item disabled>双皮奶</el-dropdown-item>
                    <el-dropdown-item command="蚵仔煎" divided>蚵仔煎</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {
                    info:""
                }
            },
            methods: {
                handleCommand(command) {
                    v.info = command;
                    this.$message('click on item ' + command);


                }
            }
        })
    </script>
</html>

选择器

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">
            <h3>{{value}}</h3>
            <template>
                <el-select v-model="value" placeholder="请选择">
                    <!--label设置显示的内容 value设置选中后得到的值-->
                    <el-option
                               v-for="item in options"
                               :label="item.label"
                               :value="item.value">
                    </el-option>
                </el-select>
                <hr>
                <h3>您选择的商品价值:{{price}}</h3>
                <el-select v-model="price" placeholder="请选择">
                    <!--label设置显示的内容 value设置选中后得到的值-->
                    <el-option
                               v-for="p in arr"
                               :label="p.title"
                               :value="p.price">
                    </el-option>
                </el-select>
            </template>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {
                    price:"",
                    arr:[{title:"麦克风",price:100},
                         {title:"鼠标",price:30},
                         {title:"键盘",price:50},
                         {title:"显示器",price:800}],
                    options: [{
                        value: '选项1',
                        label: '黄金糕'
                    }, {
                        value: '选项2',
                        label: '双皮奶'
                    }, {
                        value: '选项3',
                        label: '蚵仔煎'
                    }, {
                        value: '选项4',
                        label: '龙须面'
                    }, {
                        value: '选项5',
                        label: '北京烤鸭'
                    }],
                    value: ''
                }
            },
            methods: {

            }
        })
    </script>
</html>

表格

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">
            <template>
                <el-table
                          :data="tableData"
                          style="width: 100%">
                    <!--prop=properties 设置这一列显示的数据来自于数组中对象的哪个属性-->
                    <el-table-column
                                     prop="date"
                                     label="日期"
                                     width="100">
                    </el-table-column>
                    <el-table-column
                                     prop="name"
                                     label="姓名"
                                     width="180">
                    </el-table-column>
                    <el-table-column
                                     prop="address"
                                     label="地址">
                    </el-table-column>
                </el-table>
                <hr>

                <el-table :data="arr" style="width: 100%">
                    <!--添加编号列-->
                    <el-table-column type="index" label="编号"></el-table-column>
                    <!--prop=properties 设置这一列显示的数据来自于数组中对象的哪个属性-->
                    <el-table-column prop="name" label="姓名" width="100">
                    </el-table-column>
                    <el-table-column prop="salary" label="工资" width="180">
                    </el-table-column>
                    <el-table-column prop="job" label="工作">
                    </el-table-column>
                    <!--添加自定义列开始-->
                    <el-table-column label="操作">
                        <!--scope对象里面装的是当前行所对应的一些信息
scope.$index得到当前行的下标
scope.row得到的是当前行对应的数组里面的对象
-->
                        <template slot-scope="scope">
                            <el-button size="mini" type="danger"
                                       @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                    <!--添加自定义列结束-->

                </el-table>
            </template>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {
                    arr:[{name:"张三",salary:3000,job:"人事"},
                         {name:"李四",salary:4000,job:"销售"},
                         {name:"王五",salary:5000,job:"程序员"}],
                    tableData: [{
                        date: '2016-05-02',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1518 弄'
                    }, {
                        date: '2016-05-04',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1517 弄'
                    }, {
                        date: '2016-05-01',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1519 弄'
                    }, {
                        date: '2016-05-03',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1516 弄'
                    }]
                }
            },
            methods: {
                handleDelete(i,emp){
                    v.arr.splice(i,1);//从数组中删除数据
                    v.$message.success("成功删除了"+emp.name);
                }
            }
        })
    </script>
</html>

走马灯

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
        <style>
            .el-carousel__item h3 {
                color: #475669;
                font-size: 14px;
                opacity: 0.75;
                line-height: 150px;
                margin: 0;
            }

            .el-carousel__item:nth-child(2n) {
                background-color: #99a9bf;
            }

            .el-carousel__item:nth-child(2n+1) {
                background-color: #d3dce6;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <template>
                <div class="block">
                    <span class="demonstration">默认 Hover 指示器触发</span>
                    <el-carousel height="150px">
                        <el-carousel-item v-for="item in 4">
                            <h3 class="small">{{ item }}</h3>
                        </el-carousel-item>
                    </el-carousel>
                </div>
                <div class="block">
                    <span class="demonstration">Click 指示器触发</span>
                    <el-carousel trigger="click" height="150px">
                        <el-carousel-item v-for="item in 4" :key="item">
                            <h3 class="small">{{ item }}</h3>
                        </el-carousel-item>
                    </el-carousel>
                </div>
            </template>
            <h3>自己的走马灯</h3>
            <div style="width: 400px">
                <el-carousel height="150px">
                    <el-carousel-item>
                        <img src="b1.jpg" height="100%" width="100%">
                    </el-carousel-item>
                    <el-carousel-item>
                        <img src="b2.jpg" height="100%" width="100%">
                    </el-carousel-item>
                    <el-carousel-item>
                        <img src="b3.jpg" height="100%" width="100%">
                    </el-carousel-item>
                </el-carousel>
                <h3>数组走马灯</h3>
                <div style="width: 400px">
                    <el-carousel height="150px">
                        <el-carousel-item v-for="url in arr">
                            <img :src="url" width="100%" height="100%">
                        </el-carousel-item>
                    </el-carousel>
                </div>
            </div>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {
                    arr:["b1.jpg","b2.jpg","b3.jpg","b4.jpg"]
                }
            },
            methods: {

            }
        })
    </script>
</html>

导航栏

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">
            <!--default-active设置默认选中的位置
mode="horizontal"用来设置横向显示,去掉mode默认为纵向显示-->
            <el-menu :default-active="activeIndex"
                     class="el-menu-demo" mode="horizontal" @select="handleSelect">
                <el-menu-item index="1">处理中心</el-menu-item>
                <!--submenu子菜单-->
                <el-submenu index="2">
                    <!--设置子菜单标题-->
                    <template slot="title">我的工作台</template>
                    <el-menu-item index="2-1">选项1</el-menu-item>
                    <el-menu-item index="2-2">选项2</el-menu-item>
                    <el-menu-item index="2-3">选项3</el-menu-item>
                    <el-submenu index="2-4">
                        <template slot="title">选项4</template>
                        <el-menu-item index="2-4-1">选项1</el-menu-item>
                        <el-menu-item index="2-4-2">选项2</el-menu-item>
                        <el-menu-item index="2-4-3">选项3</el-menu-item>
                    </el-submenu>
                </el-submenu>
                <!--disabled让当前的菜单项失效-->
                <el-menu-item index="3" disabled>消息中心</el-menu-item>
                <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
            </el-menu>


            <div class="line"></div>
            <el-menu
                     :default-active="activeIndex2"
                     class="el-menu-demo"
                     mode="horizontal"
                     @select="handleSelect"
                     background-color="#545c64"
                     text-color="#fff"
                     active-text-color="#ffd04b">
                <el-menu-item index="1">处理中心</el-menu-item>
                <el-submenu index="2">
                    <template slot="title">我的工作台</template>
                    <el-menu-item index="2-1">选项1</el-menu-item>
                    <el-menu-item index="2-2">选项2</el-menu-item>
                    <el-menu-item index="2-3">选项3</el-menu-item>
                    <el-submenu index="2-4">
                        <template slot="title">选项4</template>
                        <el-menu-item index="2-4-1">选项1</el-menu-item>
                        <el-menu-item index="2-4-2">选项2</el-menu-item>
                        <el-menu-item index="2-4-3">选项3</el-menu-item>
                    </el-submenu>
                </el-submenu>
                <el-menu-item index="3" disabled>消息中心</el-menu-item>
                <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
            </el-menu>
            <h3>自己的导航菜单</h3>
            <el-menu mode="horizontal">
                <el-menu-item v-for="(item,i) in arr" :index="i+1">{{item}}</el-menu-item>
            </el-menu>
            <h4>侧边导航菜单</h4>
            <div style="width: 300px;background-color: #666">
                <el-menu
                         default-active="2"
                         class="el-menu-vertical-demo"
                         @open="handleOpen"
                         @close="handleClose">
                    <el-submenu index="1">
                        <template slot="title">我的工作台</template>

                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>导航一</span>
                        </template>
                        <el-menu-item-group>
                            <template slot="title">分组一</template>
                            <el-menu-item index="1-1">选项1</el-menu-item>
                            <el-menu-item index="1-2">选项2</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="分组2">
                            <el-menu-item index="1-3">选项3</el-menu-item>
                        </el-menu-item-group>
                        <el-submenu index="1-4">
                            <template slot="title">选项4</template>
                            <el-menu-item index="1-4-1">选项1</el-menu-item>
                        </el-submenu>
                    </el-submenu>
                    <el-menu-item index="2">
                        <i class="el-icon-menu"></i>
                        <span slot="title">导航二</span>
                    </el-menu-item>
                    <el-menu-item index="3" disabled>
                        <i class="el-icon-document"></i>
                        <span slot="title">导航三</span>
                    </el-menu-item>
                    <el-menu-item index="4">
                        <i class="el-icon-setting"></i>
                        <span slot="title">导航四</span>
                    </el-menu-item>
                </el-menu>
            </div>
        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {
                    activeIndex: '3',
                    activeIndex2: '1',
                    arr:["首页","直播课","线上课","脱产班","关于我们"]
                }
            },
            methods: {
                handleSelect(key, keyPath) {
                    console.log(key, keyPath);
                },
                handleOpen(key, keyPath) {
                    console.log(key, keyPath);
                },
                handleClose(key, keyPath) {
                    console.log(key, keyPath);
                }
            }
        })
    </script>
</html>

综合员工列表练习

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <!-- import CSS -->
        <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    </head>
    <body>
        <div id="app">
            <input type="text" placeholder="姓名" v-model="emp.name">
            <input type="text" placeholder="工资" v-model="emp.salary">
            <input type="text" placeholder="工作" v-model="emp.job">
            <input type="button" value="添加" @click="add()">
            <h3>员工列表</h3>

            <el-table :data="arr">
                <el-table-column type="index" label="编号"></el-table-column>
                <el-table-column prop="name" label="名字"></el-table-column>
                <el-table-column prop="salary" label="工资"></el-table-column>
                <el-table-column prop="job" label="工作"></el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button size="mini" type="danger"
                                   @click="handleDelete(scope.$index, scope.row)">删除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>

        </div>
    </body>
    <!-- import Vue before Element -->
    <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
    <!-- import JavaScript -->
    <script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
    <script>
        let v = new Vue({
            el: '#app',
            data: function () {
                return {
                    emp: {name: "", salary: "", job: ""},
                    arr: [{name: "张三", salary: 3000, job: "人事"},
                          {name: "李四", salary: 4000, job: "销售"},
                          {name: "王五", salary: 5000, job: "程序员"}]
                }
            },
            methods: {
                add() {
                    v.arr.push({name: v.emp.name, salary: v.emp.salary, job: v.emp.job});
                },
                handleDelete(i, emp) {
                    v.arr.splice(i, 1);
                    v.$message.success("成功删除了" + emp.name);
                }
            }
        })
    </script>
</html>

到了这里,关于Java阶段三Day05的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Java阶段二Day12

    JDBC Java数据库连接 Java Database Connectivity ,是java官方提供的一套结构,用于连接DBMS并进行相关操作 核心接口 Connection: 表示数据库连接 Statement: 用来执行SQL语句的语句对象 PreparedStatement: 用来执行预编译SQL语句的语句对象用来表示查询结果集 ResultSet: 用来表示查询结构集

    2024年02月01日
    浏览(32)
  • Java阶段一Day17

    概念 File的每一个实例用于表示一个文件或目录的 使用File可以: 1:访问文件或目录的属性 2:创建/删除文件或目录 3:访问一个目录中的所有子项 但是File不能:访问文件数据 涉及的新单词: file-文件 write-写 read-读 hidden-隐藏 create-创建 make-作 directory-目录 exists-存在 accept-接受 File的

    2023年04月09日
    浏览(27)
  • Java阶段五Day18

    面试题整理 目标: 整理相关问题的话术,碰到问题 思路: 概念 是什么 原因 为什么 解决方案 如何解决 缓存雪崩 : 概念: 缓存在长期应用的系统中,存储了大量的高并发访问数据,一旦这些数据突然批量消失,访问吞吐的并发,到达数据库,导致数据库崩溃 原因: 大量

    2024年02月14日
    浏览(44)
  • Java阶段二Day11

    主键与外键 主键(PK):一张表中通常第一个字段为主键字段,用来唯一标识表中的一条记录.主键要求的条件是非空且唯一 外键(FK):一张表中一个字段保存了另一张表中主键字段的值,那么这个字段就是外键字段 在关联关系中,两张表通常就是使用主外键进行关联的,

    2024年02月01日
    浏览(35)
  • Java阶段二Day01

    StringBuilder是线程不安全的 StringBuffer是线程安全的,它的 append 方法有 synchronized 修饰 StringBuffer是1.0时候出现的,StringBuilder是1.5时候出现的 一般不再多线程情况下使用同一个字符串,所以对线程安全效率低的StringBuffer用的少,所以出现了StringBuilder,其线程虽不安全但是效率高

    2023年04月15日
    浏览(28)
  • Java阶段五Day09

    Path , Host 断言都可以实现多服务网关入口 Path 做断言没有跨域问题的(路径断言 域名和端口统一的) 跨域: 只要资源访问请求原始域和目标域其中域名和端口有一个不一样,就叫做跨域 以京东首页为例,理解 cors 首页有一个 ajax 请求 访问 getInfo 资源访问服务 https://black

    2024年02月17日
    浏览(26)
  • Java阶段五Day16

    启动servlet冲突问题 解决方法:启动项目main 将传递过来 servlet-api 依赖去除 nacos注册中心 依赖 yaml配置 用户信息验证失败 断点查看源代码 LoginUserFilter (在处理网关解析后的 jwt 数据 userJson 字符串) 如果过滤器不生效,就会导致解析 userJson 没执行,后端代码获取 LongUser 对象

    2024年02月14日
    浏览(25)
  • Java阶段四Day11

    AOP:面向切面编程 注意:AOP并不是Spring原创的技术,也不是Spring的独家技术,而是源自AspectJ,只是Spring很好的支持了AOP。 AOP技术主要解决了“横切关注”的相关问题,也就是“若干个不同的方法都需要执行相同的任务”的问题! 在许多框架中,都通过AOP技术实现了对应的功

    2024年02月13日
    浏览(26)
  • UnityShader——05几何阶段和光栅化阶段

    几何阶段和光栅化阶段,开发者无法拥有绝对的控制权,其实现的载体是GPU,GPU通过实现流水线化,大大加快了渲染进度。虽然无法完全控制着两个阶段的实现细节,但GPU向开发者开放了很多控制权 顶点数据 为输入,顶点数据是由应用阶段加载到显存中,再由 Draw Call 指定的

    2024年02月20日
    浏览(23)
  • 05JVM_类加载阶段

    1.1 介绍 ①Java源代码经编译生成 字节码文件 ,通过 类加载阶段 将字节码 载入方法区 。 ②类加载阶段内部是C++的 instanceKlass 描述java类,重要的域field有: ③类有父类,先加载父类。 ④加载和链接可能交替运行 1.2 注意 ①加载的类在JVM创建相应的类结构instanceKlass的元数据存

    2024年02月09日
    浏览(21)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包