vue+element简单实现商城网站首页,模仿小米电商商城(一)

news/2024/5/20 14:21:35/文章来源:https://yxsdgz.blog.csdn.net/article/details/121544242

1.本案例灵感来源于小米官网 https://www.mi.com/

 项目演示地址:可私聊作者获取(演示地址不定时变化)

源码

官方截图

 产品效果图:

二级菜单、产品详情

 

 购物车

2.首先创建vue项目,采用开发工具Hbuilder。vue创建项目教程可参考:(一)Vue——如何创建一个Vue项目(完整步骤) - 㭌(mou)七 - 博客园

3.创建项目后安装elementui,按照官方教程即可,elementui官方地址:Element - The world's most popular Vue UI framework

   创建好的项目目录结构大概这样子:

 

 4.整个框架布局分为头部 src/page/top、内容src/page/index和底部src/page/foot。

内容src/page/index为一个共用容器,就像iframe标签一样,所有的路径访问将会显示在容器中,页面跳转的路径定义在src/router/index.js中

5.src/page/top/index.vue

<template><div style="background-color: #3e3e3e;font-size: 14px;"><div style="width: 60%;height: 40px;margin: 0 auto;display: flex;"><div style="display: flex;flex: 1;"><div class="active">小米商城</div><div class="active">MUI</div><div class="active">LOT</div><div class="active">云服务</div><div class="active">金融</div><div class="active">有品</div><div class="active">小爱开发平台</div><div class="active">政企服务</div><div class="active">下载app</div><div class="active">Select Region</div></div><div style="width: 258px;text-align: right;display: flex;"><div class="active" @click="loginModal">登录</div><div class="active">注册</div><div class="active">消息通知</div><div class="shop-car">购物车(0)</div></div></div><!-- 登录弹窗 --><el-dialogtitle="User Login":visible.sync="box"width="400px"center><div><el-form class="login-form"status-icon:rules="loginRules"ref="loginForm":model="loginForm"label-width="0"><el-form-item prop="username"><el-input size="small"@blur="handleLogin"v-model="loginForm.username"auto-complete="off"placeholder="用户名"><i slot="prefix" class="el-icon-user el-icon--right"/></el-input></el-form-item><el-form-item prop="password"><el-input size="small"@blur="handleLogin":type="passwordType"v-model="loginForm.password"auto-complete="off"placeholder="密码"><i class="el-icon-view el-input__icon" slot="suffix" @click="showPassword"/><i slot="prefix" class="el-icon-lock el-icon--right"/></el-input></el-form-item><el-form-item><el-row :span="24"><el-col :span="12"><el-checkbox v-model="loginForm.autoLogin">下次自动登录</el-checkbox></el-col><el-col :span="12" style="text-align: right;"><el-button type="primary"style="width: 100px;"@click.native.prevent="handleLogin"class="login-submit">登录</el-button></el-col></el-row></el-form-item></el-form></div></el-dialog></div>
</template><script>export default {data() {return {activeIndex: '1',activeIndex2: '1',box: false,loginForm: {username: "",//密码password: "",autoLogin: false},loginRules: {username: [{required: true, message: "请输入用户名", trigger: "blur"}],password: [{required: true, message: "请输入密码", trigger: "blur"},{min: 1, message: "密码长度最少为6位", trigger: "blur"}]},passwordType: "password"};},mounted() {},methods: {homePage(){this.$router.push({path: '/home/index'});},handleSelect(key, keyPath) {console.log(key);if(key == '1'){this.$router.push({path: '/home/index'});}else{this.$router.push({path: '/test/index'});}},loginModal(){this.box = true;},showPassword() {this.passwordType === ""? (this.passwordType = "password"): (this.passwordType = "");},handleLogin() {//登录this.$refs.loginForm.validate(valid => {if (valid) {const loading = this.$loading({lock: true,text: '登录中,请稍后。。。',spinner: "el-icon-loading"});setTimeout(function(){loading.close();},1000)}});},}};
</script><style>.active{line-height: 40px;color: #cfcfcf;margin-right: 20px;font-size: 12px;}.active:hover{cursor: pointer;color: #FFFFFF;}.shop-car{text-align: center;cursor: pointer;width: 100px;line-height: 40px;height: 40px;display: inline-block;background-color: #8f8f8f;}.shop-car:hover{background-color: #00FFFF;}
</style>

6.src/page/index/index.vue

<template><div style="width: 100%;height: 100%;overflow: auto;"><top></top><router-view></router-view><foot></foot></div>
</template><script>import top from "../top/index.vue";import foot from "../foot/index";export default {components: {top,foot},name: "index",data() {return {};},mounted() {},methods: {}};
</script><style>
</style>

7.src/page/foot/index.vue

<template><div style="font-size: 14px;"><div style="width: 60%;margin: 0 auto;margin-bottom: 30px;"><div style="display: flex;"><div style="flex: 1;"><div class="foot-title">帮助中心</div><div class="foot-item">账户管理</div><div class="foot-item">购物指南</div><div class="foot-item">订单操作</div></div><div style="flex: 1;"><div class="foot-title">服务支持</div><div class="foot-item">账户管理</div><div class="foot-item">购物指南</div><div class="foot-item">订单操作</div></div><div style="flex: 1;"><div class="foot-title">线下门店</div><div class="foot-item">账户管理</div><div class="foot-item">购物指南</div><div class="foot-item">订单操作</div></div><div style="flex: 1;"><div class="foot-title">关于小米</div><div class="foot-item">账户管理</div><div class="foot-item">购物指南</div><div class="foot-item">订单操作</div></div><div style="flex: 1;"><div class="foot-title">关于我们</div><div class="foot-item">账户管理</div><div class="foot-item">购物指南</div><div class="foot-item">订单操作</div></div></div></div><div style="background-color: #3e3e3e;height: 40px;text-align: center;line-height: 40px;color: #afafaf;">申明:本网页仅供学习参考 @XXX XXX XXX</div></div></template><script>
</script><style>.foot-title{height: 40px;line-height: 40px;}.foot-item{height: 25px;line-height: 25px;color: gray;}.foot-item:hover{cursor: pointer;color: #e37a2f;}
</style>

8.源码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_754212.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

vue+elementui实现非常好看的博客、网站首页,网站模板

1.效果图&#xff0c;设计上美观大方 源码 2.首先创建vue项目&#xff0c;采用开发工具Hbuilder。vue创建项目教程可参考&#xff1a;&#xff08;一&#xff09;Vue——如何创建一个Vue项目(完整步骤) - 㭌&#xff08;mou&#xff09;七 - 博客园 3.创建项目后安装elementui…

vue+element简单实现商城网站首页,模仿电商商城

1.安装启动vue项目可参考 vueelement简单实现商城网站首页&#xff0c;模仿小米电商商城https://blog.csdn.net/lucky_fang/article/details/121544242 本项目源码下载https://download.csdn.net/download/lucky_fang/85161752 2.产品效果图 3.项目结构图 4.src/page/top/ind…

衣服、商品、商城网站模板首页,仿U袋网,vue+elementui简洁实现

1.本案例灵感来源于网络 项目演示地址&#xff1a;可私聊作者获取&#xff08;演示地址不定时变化&#xff09; 仿照来源&#xff1a;网络案例 以下源码是第一版源码&#xff0c;最新源码请私聊作者获取&#xff0c;或通过博客后面微信名片添加作者 源码https://download.c…

生鲜水果商品商城静态网站,vue+elementui简单实现

1.安装启动vue项目 &#xff08;一&#xff09;Vue——如何创建一个Vue项目(完整步骤) - 㭌&#xff08;mou&#xff09;七 - 博客园 2.elementui官网 Element - The worlds most popular Vue UI framework 3.如果你下载的是本项目源码&#xff0c;则步骤一中可以不用执行&a…

html+css响应式旅游主题网站模板,旅游网站,企业文化新闻类网站,简单web假期课程作业

1.灵感来源预览 社区、企业、公益共享交流平台_优享人app-优享时代官网 2.demo效果图&#xff0c;同时兼容手机端访问&#xff0c;所有菜单都已完善功能&#xff0c;即拿即用&#xff0c;很简单 源码下载https://download.csdn.net/download/lucky_fang/85320989 手机端访问…

web静态网站,css+html旅游景点网站,web假期作业

1.项目共分为8个网页&#xff1a; 首页、历史文化、景区概况、推荐游玩、美食一览、文化活动、地理位置、联系我们 纯csshtml实现的静态网页&#xff0c;很适合新手学习和使用&#xff0c; 源码下载 如下图&#xff0c;首页&#xff1a; 含背景音乐循环播放&#xff0c;自…

vue+elementui+springboot前后端分离实现学校帖子网站,模拟“淘柳职”学校大作业

一.技术实现 项目演示地址&#xff1a;可私聊作者获取&#xff08;演示地址不定时变化&#xff09; 前端 vueelementui&#xff1b; 后端&#xff1a; SpringBootOAuth2Spring SecurityRedismybatis-plusmysqlswagger 二.前言 淘柳职网站&#xff1a;淘柳职 本项目完全是…

程序猿最应去的网站有哪些?

2019独角兽企业重金招聘Python工程师标准>>> 要想成为优秀的程序猿&#xff0c;不仅要有一定天分&#xff0c;常与大神交流&#xff0c;自己多加练习才是正确的方法。下面是一些Quora用户推荐的国外网站&#xff0c;与广大程序猿或者希望学习编程的朋友们分享&#…

通过建立自己的AuthorizeAttribute实现网站的权限管理

2019独角兽企业重金招聘Python工程师标准>>> 当我们用.net MVC构建网站平台的时候&#xff0c;势必会对网站平台的安全性和用户的使用权限进行一个统一的构建&#xff0c;首先在.net MVC 架构中&#xff0c;系统已经将权限管理分为三个层面来进行管理&#xff0c;第…

delphi RAD Studio新版本及路线图 及官方网站 官方 版本发布时间

delphi RAD Studio Berlin 10.1 主要是FireMonkey 移动开发的改动&#xff0c;VCL确实没有多大变化。 http://docwiki.embarcadero.com/RADStudio/Berlin/en/Main_Page http://docwiki.embarcadero.com/RADStudio/Berlin/en/Whats_New EMB 官网地址资源 Bug fix list for RAD …

网站调查方法步骤.

1.查看对方网站pr值2.查看对方在搜索引擎快照的新鲜度3.到http://whois.domaintolls.com查看对方域名注册信息4.到http://www.archive.org查看对方的收录历史5.查看对方在搜索引擎的收录数6.查看对方的外部链接数7.查看对方是否被雅虎目录&#xff0c;开放目录dmoz.org,好123收…

大型网站架构演变

初级篇&#xff1a;&#xff08;单机模式&#xff09;假设配置&#xff1a;&#xff08;Dual core 2.0GHz,4GB ram,SSD&#xff09;基础框架&#xff1a;apache(PHP) Mysql / IIS MSSQL&#xff08;最基础框架&#xff0c;处理一般访问请求&#xff09;进阶1&#xff1a;替换…

在线流程图与图表制作网站

现在很多功能网站&#xff0c;最常见的就是图片处理类&#xff0c;不如切图&#xff0c;图片转换&#xff0c;添加效果等。本文收集了国外最常用的流程图与图表制作网站&#xff0c;这些网站功能强大&#xff0c;如果你正好需要制作图表或流程图&#xff0c;而对于软件又不熟悉…

linux条件编译预编译,C语言条件编译_Linux编程_Linux公社-Linux系统门户网站

C语言中的预编译包含三种&#xff1a;1.宏定义2.文件包含3.条件编译&#xff0c;条件编译指的是满足一定条件下才进行编译&#xff0c;它有几种形式&#xff1a;(1)#ifdef标识符//程序#else//程序#endif它的意义为如果定义了标识符&#xff0c;则执行程序段1&#xff0c;否则执…

inputstream怎么写给前端_写给大家看的网站制作教程01了解网站制作流程

作者 | 杨小二来源 | web前端开发(ID&#xff1a;webqdkf)前言这些年里&#xff0c;被读者和周围朋友以及一些认识的人&#xff0c;问的最多的问题&#xff0c;就是&#xff0c;怎么做一个自己的网站&#xff1f;这个难不难学呀&#xff1f;其实&#xff0c;我知道&#xff0c;…

Web层框架对网站中所有异常的统一处理

一个网站的异常信息作为专业的人士&#xff0c;是不会轻易暴露给用户的&#xff0c;因为那样狠不安全&#xff0c;显得你漏是一回事&#xff0c;只要还是考虑到网站的数据安全问题&#xff0c;下面给大家分享一下一些常见的web层框架是如何处理统一的异常。 之前都是在Struts2…

修改网站自动关闭时间timeout_centos7修改网卡名称为ethX

测试平台VMWARE WORKSTATION 15 虚拟机系统Centos7centos7网卡的随机名给自动化运维带来混乱&#xff0c;那么我们把网卡名重新配置为ethX一、在安装系统的时候配置&#xff1a;修改内核选项&#xff1a;net.ifnames0 biosdevname0二、已安装系统修改方法像我的虚拟机&#xff…

旧版ios软件网站_ios旧版软件抓包

大家好&#xff0c;这里是小虾虾科技屋——————————————————————有时候&#xff0c;某个软件随着更新&#xff0c;会带走许多历史的痕迹&#xff0c;于是有的人就想尝试复原那些软件&#xff0c;所以产生了今天为大家分享的工具。iTunes旧版软件抓包神器&a…

seo按天扣费系统源码_企业SEO外包,这样选靠谱!

原标题&#xff1a;企业SEO外包&#xff0c;这样选靠谱&#xff01;一般在选择企业SEO外包的时候&#xff0c;需要注意什么点?一、清晰企业网站SEO优化定位清晰企业网站SEO优化定位对于企业的的目标定位&#xff0c;大家说法不一&#xff0c;但是总体上作为企业的负责任你需要…

突发!32TB Windows 10核心数据泄漏,被人上传至第三方公开网站

本文讲的是突发&#xff01;32TB Windows 10核心数据泄漏&#xff0c;被人上传至第三方公开网站&#xff0c;据外媒The Register报道&#xff0c;微软Windows操作系统内部大量组件和核心代码泄漏&#xff0c;正在网络上传播。 这些泄漏的数据多达32TB&#xff0c;包括微软未公开…