续day06笔记后续的两个小案例
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <!-- import CSS -->
- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/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" :key="item">
- <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>
- <h1>带图片的轮播图</h1>
- <div style="width: 350px">
- <el-carousel trigger="click" height="150px">
- <el-carousel-item v-for="item in arr">
- <img :src="item" width="100%" alt="">
- </el-carousel-item>
- </el-carousel>
- </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://unpkg.com/element-ui/lib/index.js"></script>
- <script>
- let v = new Vue({
- el: '#app',
- data: function() {
- return {//在这里面定义变量
- arr:["imgs/b1.jpg","imgs/b2.jpg","imgs/b3.jpg","imgs/b4.jpg"]
- }
- }
- })
- </script>
- </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">
- <style>
- .el-header {
- background-color: #B3C0D1;
- color: #333;
- line-height: 60px;
- }
-
- .el-aside {
- color: #333;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <el-container>
- <el-aside width="200px">
- <el-menu :default-openeds="['1', '3']">
- <el-submenu index="1">
- <template slot="title"><i class="el-icon-message"></i>导航一</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">选项4-1</el-menu-item>
- </el-submenu>
- </el-submenu>
- <el-submenu index="2">
- <template slot="title"><i class="el-icon-menu"></i>导航二</template>
- <el-menu-item-group>
- <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-group>
- <el-menu-item-group title="分组2">
- <el-menu-item index="2-3">选项3</el-menu-item>
- </el-menu-item-group>
- <el-submenu index="2-4">
- <template slot="title">选项4</template>
- <el-menu-item index="2-4-1">选项4-1</el-menu-item>
- </el-submenu>
- </el-submenu>
- <el-submenu index="3">
- <template slot="title"><i class="el-icon-setting"></i>导航三</template>
- <el-menu-item-group>
- <template slot="title">分组一</template>
- <el-menu-item index="3-1">选项1</el-menu-item>
- <el-menu-item index="3-2">选项2</el-menu-item>
- </el-menu-item-group>
- <el-menu-item-group title="分组2">
- <el-menu-item index="3-3">选项3</el-menu-item>
- </el-menu-item-group>
- <el-submenu index="3-4">
- <template slot="title">选项4</template>
- <el-menu-item index="3-4-1">选项4-1</el-menu-item>
- </el-submenu>
- </el-submenu>
- </el-menu>
- </el-aside>
- <el-container>
- <el-header style="text-align: right">
- <el-dropdown>
- <i class="el-icon-setting" style="margin-right: 15px"></i>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item>查看</el-dropdown-item>
- <el-dropdown-item>新增</el-dropdown-item>
- <el-dropdown-item>删除</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <span>王小虎</span>
- </el-header>
- <el-main>
- <el-table :data="tableData">
- <el-table-column prop="date" label="日期" width="140">
- </el-table-column>
- <el-table-column prop="name" label="姓名" width="120">
- </el-table-column>
- <el-table-column prop="address" label="地址">
- </el-table-column>
- </el-table>
- </el-main>
- </el-container>
- </el-container>
- </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://unpkg.com/element-ui/lib/index.js"></script>
- <script>
- let v = new Vue({
- el: '#app',
- data: function() {
- const item = {
- date: '2016-05-02', name: '王小虎', address: '上海市普陀区金沙江路 1518 弄'
- };
- return {//在这里面定义变量
- tableData: Array(20).fill(item)
- }
- }
- })
- </script>
- </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">
- <style>
- body{
- margin: 0;/*去掉自带的8个像素外边距*/
- background-image: url("imgs/bg.jpg");
- /*cover封面 */
- background-size: cover;
- text-align: center;
- }
- h1{
- font-size: 72px;
- color: rgb(0,150,220);
- margin-bottom: 0;
- }
- img{width: 100px}
- h2{
- font-size: 32px;
- color: rgb(0,150,220);
- margin: 0;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <h1>欢迎来到酷鲨商城</h1>
- <img src="imgs/shark.png" alt="">
- <h2>CoolSharkMall</h2>
- <el-card style="width: 600px;height: 300px;margin: 0 auto;
- background-color: rgba(255,255,255,0.3)">
- <!--label-width设置左侧文本的宽度-->
- <el-form style="width: 400px;margin: 50px auto" label-width="60px">
- <el-form-item label="用户名">
- <el-input type="text" placeholder="请输入用户名"></el-input>
- </el-form-item>
- <el-form-item label="密码">
- <el-input type="password" placeholder="请输入密码"></el-input>
- </el-form-item>
- <el-form-item >
- <el-button style="position: relative;right: 30px" type="primary">登录</el-button>
- </el-form-item>
- </el-form>
-
- </el-card>
- </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://unpkg.com/element-ui/lib/index.js"></script>
- <script>
- let v = new Vue({
- el: '#app',
- data: function() {
- return {//在这里面定义变量
-
- }
- }
- })
- </script>
- </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">
- <style>
- header a {
- text-decoration: none;
- color: #6c6c6c;
- }
- .el-menu.el-menu--horizontal {
- border-bottom: none;
- }
- .el-table .el-table__cell{
- padding: 0;/*去掉排行榜表格中上下的内边距*/
- }
- </style>
- </head>
- <body>
- <div id="app">
- <el-container>
- <el-header height="150">
- <div style="width: 1200px;margin: 0 auto">
- <img src="imgs/logo.png" style="width: 300px;vertical-align: middle" alt="">
- <span>
- <a href="">首页</a><el-divider direction="vertical"></el-divider>
- <a href="">热点咨询</a><el-divider direction="vertical"></el-divider>
- <a href="">商家入驻</a><el-divider direction="vertical"></el-divider>
- <a href="">社会招聘</a><el-divider direction="vertical"></el-divider>
- <a href="">校园招聘</a><el-divider direction="vertical"></el-divider>
- <a href="">帮助</a>
- </span>
- </div>
- <!--蓝色导航菜单开始-->
- <div style="background-color: #82c8ec">
- <el-menu style="width: 1200px;margin: 0 auto"
- :default-active="1"
- class="el-menu-demo"
- mode="horizontal"
- background-color="#82c8ec"
- text-color="#fff"
- active-text-color="#fff">
- <el-menu-item v-for="c in categoryArr" :index="c.id">{{c.name}}</el-menu-item>
- <!--搜索框开始-->
- <div style="float: right;margin-top: 10px">
- <el-input placeholder="请输入搜索内容">
- <!--slot="append"作用是将按钮追加在搜索框的后面-->
- <el-button slot="append" icon="el-icon-search"></el-button>
- </el-input>
- </div>
- <!--搜索框结束-->
- </el-menu>
- </div>
- <!--蓝色导航菜单结束-->
- </el-header>
- <el-main style="width: 1200px;margin: 0 auto">
- <!--轮播图和排行榜开始-->
- <el-row :gutter="20">
- <el-col :span="18">
- <el-carousel trigger="click" height="300px">
- <el-carousel-item v-for="item in bannerArr">
- <img :src="item" width="100%" alt="">
- </el-carousel-item>
- </el-carousel>
- </el-col>
- <el-col :span="6">
- <el-card style="height: 300px">
- <h3>
- <i style="font-weight: bold" class="el-icon-trophy">销量最高</i>
- </h3>
- <el-divider></el-divider>
- <el-table :data="topArr" style="width: 100%">
- <!--type="index" 让这一列显示成编号-->
- <el-table-column type="index" label="排名" width="50">
- </el-table-column>
- <el-table-column prop="title" label="商品名" width="80">
- </el-table-column>
- <el-table-column prop="saleCount" label="销量" width="80">
- </el-table-column>
- </el-table>
- </el-card>
- </el-col>
- </el-row>
- <!--轮播图和排行榜结束-->
- <!--商品列表开始-->
- <el-row :gutter="20">
- <el-col :span="6" v-for="p in productArr" style="margin-top: 20px">
- <el-card>
- <img :src="p.url" width="100%" alt="">
- <div>
- <p style="font-size: 15px;height: 40px;margin-top: 0">{{p.title}}</p>
- <div style="color: #666">
- <span>¥{{p.price}}</span>
- <s style="font-size: 12px">{{p.oldPrice}}</s>
- <span style="float: right">销量:{{p.saleCount}}</span>
- </div>
-
- </div>
- </el-card>
- </el-col>
- </el-row>
- <!--商品列表结束-->
- </el-main>
- <el-footer>
- <div style="height: 95px;background-image: url('imgs/wave.png');margin-bottom: -30px"></div>
- <div style="height: 100px;background-color: #3f3f3f;
- padding: 30px;text-align: center;color: #b1b1b1">
- <p>Copyright © 北京达内金桥科技有限公司版权所有 京ICP备12003709号-3 京公网安备 11010802029572号</p>
- <p>涵盖20余门课程体系,致力于打造权威的IT职业教育学习平台</p>
- <p>达内在线WWW.TMOOC.CN 专注于IT职业技能培训</p>
- </div>
- </el-footer>
- </el-container>
- </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://unpkg.com/element-ui/lib/index.js"></script>
- <script>
- let v = new Vue({
- el: '#app',
- data: function () {
- return {//在这里面定义变量
- categoryArr: [{id: 1, name: "精彩活动"}, {id: 2, name: "当季女装"},
- {id: 3, name: "品牌男装"}, {id: 4, name: "环球美食"}, {id: 5, name: "医药健康"},
- {id: 6, name: "美妆彩妆"}, {id: 7, name: "母婴产品"}
- ],
- bannerArr:["imgs/b1.jpg","imgs/b2.jpg","imgs/b3.jpg","imgs/b4.jpg"],
- topArr:[{title:"小米手机",saleCount:988},
- {title:"李宁球鞋",saleCount:708},
- {title:"毛巾",saleCount:653},
- {title:"安踏拖鞋",saleCount:553},
- {title:"阿迪袜子",saleCount:438},
- {title:"耐克上衣",saleCount:88}],
- productArr:[{title:"森马牛仔裤女宽松慢跑裤运动风2022春季新款显瘦束脚长裤复古",price:233,oldPrice:598,url:"imgs/a.jpg",saleCount:2342},
- {title:"茵曼马甲连衣裙两件套春季新款娃娃领色织格长袖背心裙套装",price:233,oldPrice:598,url:"imgs/b.jpg",saleCount:2342},
- {title:"雪中飞墨绿色短袖t恤女夏2022新款纯棉半袖打底体恤夏季上衣潮ins",price:233,oldPrice:598,url:"imgs/c.jpg",saleCount:2342},
- {title:"【佟丽娅同款】鸭鸭明星同款羽绒服2021年冬季新款时尚连帽外套冬",price:233,oldPrice:598,url:"imgs/d.jpg",saleCount:2342},
- {title:"BEASTER小恶魔鬼脸明星同款夹克毛绒保暖加厚字母印花宽松外套ins",price:233,oldPrice:598,url:"imgs/e.jpg",saleCount:2342},
- {title:"香影毛呢外套女中长款2021年冬季新款气质韩版娃娃领紫色呢子大衣",price:233,oldPrice:598,url:"imgs/f.jpg",saleCount:2342},
- {title:"SEMIR森马商场同款打底针织毛衣纯色高领新品显瘦",price:233,oldPrice:598,url:"imgs/g.jpg",saleCount:2342},
- {title:"美特斯邦威女MTEE 贺岁系列中长款风衣736598",price:233,oldPrice:598,url:"imgs/h.jpg",saleCount:2342},
- {title:"imone2021秋款黑色小西装外套女韩版学生宽松学院风外套jk外套",price:233,oldPrice:598,url:"imgs/i.jpg",saleCount:2342},
- {title:"BEASTER 小恶魔明星同款保暖长袖街头潮流连帽卫衣情侣上衣",price:233,oldPrice:598,url:"imgs/j.jpg",saleCount:2342},
- {title:"憨厚皇后100%绵羊皮2021秋海宁真皮皮衣女长款修身绵羊皮风衣外",price:233,oldPrice:598,url:"imgs/k.jpg",saleCount:2342},
- {title:"美特斯邦威高腰牛仔裤女宽松小脚新款春秋彩色潮流女士牛仔",price:233,oldPrice:598,url:"imgs/a.jpg",saleCount:2342}]
- }
- }
- })
- </script>
- </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-container>
- <el-header style="background-color: #0095d7">
- <h1 style="color: white;font-size: 22px">CoolShark商城后台管理系统
- <span style="float: right">欢迎xxx回来! <a href="">退出登录</a></span>
- </h1>
- </el-header>
- <el-container>
- <el-aside width="200px">
- <!--:default-openeds设置默认打开的子菜单-->
- <el-menu @select="handleSelect" :default-openeds="['1']">
- <el-submenu index="1">
- <!--下面是设置子菜单的标题-->
- <template slot="title">
- <i class="el-icon-s-flag"> 分类管理</i>
- </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">
- <i class="el-icon-picture"> 轮播图管理</i>
- </template>
- <!--下面是两个菜单项-->
- <el-menu-item index="2-1">轮播图列表</el-menu-item>
- <el-menu-item index="2-2">添加轮播图</el-menu-item>
- </el-submenu>
- <el-submenu index="3">
- <!--下面是设置子菜单的标题-->
- <template slot="title">
- <i class="el-icon-shopping-cart-2"> 商品管理</i>
- </template>
- <!--下面是两个菜单项-->
- <el-menu-item index="3-1">商品列表</el-menu-item>
- <el-menu-item index="3-2">添加商品</el-menu-item>
- </el-submenu>
- </el-menu>
-
- </el-aside>
- <el-main>
- <!--分类表格开始-->
- <el-table v-if="selectedIndex=='1-1'" :data="categoryArr" style="width: 100%">
- <!--prop=property属性 , 设置这一列显示的数据-->
- <el-table-column type="index" label="编号" width="280">
- </el-table-column>
- <el-table-column prop="name" label="名字" width="280">
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <!--scope里面装着这一行所对应的对象信息,scope.$index得到下标
- scope.row得到这一行对应的对象-->
- <el-button size="mini" type="danger"
- @click="friendDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--分类表格结束-->
- <!--轮播图表格开始-->
- <el-table v-if="selectedIndex=='2-1'" :data="bannerArr" style="width: 100%">
- <!--prop=property属性 , 设置这一列显示的数据-->
- <el-table-column type="index" label="编号" width="280">
- </el-table-column>
- <el-table-column label="轮播图" width="280">
- <template slot-scope="scope">
- <!--scope里面装着这一行所对应的对象信息,scope.$index得到下标
- scope.row得到这一行对应数组里面的图片路径-->
- <img :src="scope.row" width="100%" alt="">
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <!--scope里面装着这一行所对应的对象信息,scope.$index得到下标
- scope.row得到这一行对应的对象-->
- <el-button size="mini" type="danger"
- @click="friendDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--轮播图表格结束-->
- <!--商品表格开始-->
- <el-table v-if="selectedIndex=='3-1'" :data="productArr" style="width: 100%">
- <!--prop=property属性 , 设置这一列显示的数据-->
- <el-table-column type="index" label="编号" width="100">
- </el-table-column>
- <el-table-column prop="title" label="商品标题" width="200">
- </el-table-column>
- <el-table-column prop="price" label="价格" width="100">
- </el-table-column>
- <el-table-column prop="oldPrice" label="原价" width="100">
- </el-table-column>
- <el-table-column prop="saleCount" label="销量" width="100">
- </el-table-column>
- <el-table-column label="商品图片" width="100">
- <template slot-scope="scope">
- <!--scope里面装着这一行所对应的对象信息,scope.$index得到下标
- scope.row得到这一行对应数组里面的图片路径-->
- <img :src="scope.row.url" width="100%" alt="">
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <!--scope里面装着这一行所对应的对象信息,scope.$index得到下标
- scope.row得到这一行对应的对象-->
- <el-button size="mini" type="danger"
- @click="friendDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--商品表格结束-->
- </el-main>
- </el-container>
- </el-container>
- </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://unpkg.com/element-ui/lib/index.js"></script>
- <script>
- let v = new Vue({
- el: '#app',
- data: function() {
- return {//在这里面定义变量
- selectedIndex:"1-1",
- categoryArr: [{id: 1, name: "精彩活动"}, {id: 2, name: "当季女装"},
- {id: 3, name: "品牌男装"}, {id: 4, name: "环球美食"}, {id: 5, name: "医药健康"},
- {id: 6, name: "美妆彩妆"}, {id: 7, name: "母婴产品"}
- ],
- bannerArr:["imgs/b1.jpg","imgs/b2.jpg","imgs/b3.jpg","imgs/b4.jpg"],
- productArr:[{title:"森马牛仔裤女宽松慢跑裤运动风2022春季新款显瘦束脚长裤复古",price:233,oldPrice:598,url:"imgs/a.jpg",saleCount:2342},
- {title:"茵曼马甲连衣裙两件套春季新款娃娃领色织格长袖背心裙套装",price:233,oldPrice:598,url:"imgs/b.jpg",saleCount:2342},
- {title:"雪中飞墨绿色短袖t恤女夏2022新款纯棉半袖打底体恤夏季上衣潮ins",price:233,oldPrice:598,url:"imgs/c.jpg",saleCount:2342},
- {title:"【佟丽娅同款】鸭鸭明星同款羽绒服2021年冬季新款时尚连帽外套冬",price:233,oldPrice:598,url:"imgs/d.jpg",saleCount:2342},
- {title:"BEASTER小恶魔鬼脸明星同款夹克毛绒保暖加厚字母印花宽松外套ins",price:233,oldPrice:598,url:"imgs/e.jpg",saleCount:2342},
- {title:"香影毛呢外套女中长款2021年冬季新款气质韩版娃娃领紫色呢子大衣",price:233,oldPrice:598,url:"imgs/f.jpg",saleCount:2342},
- {title:"SEMIR森马商场同款打底针织毛衣纯色高领新品显瘦",price:233,oldPrice:598,url:"imgs/g.jpg",saleCount:2342},
- {title:"美特斯邦威女MTEE 贺岁系列中长款风衣736598",price:233,oldPrice:598,url:"imgs/h.jpg",saleCount:2342},
- {title:"imone2021秋款黑色小西装外套女韩版学生宽松学院风外套jk外套",price:233,oldPrice:598,url:"imgs/i.jpg",saleCount:2342},
- {title:"BEASTER 小恶魔明星同款保暖长袖街头潮流连帽卫衣情侣上衣",price:233,oldPrice:598,url:"imgs/j.jpg",saleCount:2342},
- {title:"憨厚皇后100%绵羊皮2021秋海宁真皮皮衣女长款修身绵羊皮风衣外",price:233,oldPrice:598,url:"imgs/k.jpg",saleCount:2342},
- {title:"美特斯邦威高腰牛仔裤女宽松小脚新款春秋彩色潮流女士牛仔",price:233,oldPrice:598,url:"imgs/a.jpg",saleCount:2342}]
- }
- },
- methods:{
- handleSelect(index){
- console.log(index);
- v.selectedIndex = index;
- }
- }
- })
- </script>
- </html>
页面效果展示: