路由配置
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
const routes = [{
path: '/',
name: 'Home',
component: Home
},
]
const router = new VueRouter({
routes
})
export default router
main.js
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
Vue.use(VueAwesomeSwiper)
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
APP.vue
<template>
<div id="app">
<router-view />
</div>
</template>
<style lang="scss">
* {
margin: 0;
padding: 0;
list-style: none;
outline: none;
text-decoration: none;
}
.flex {
display: flex;
}
.j-c {
justify-content: center;
}
.j-s {
justify-content: space-between;
}
.a-c {
align-items: center;
}
#app {
width: 1200px;
margin: 0 auto;
}
</style>
Banner.vue
<template>
<div class="banner">
<div class="box">
<ul>
<li v-for="(item, index) in list" :key="index" class="flex j-s a-c">
{{ item }}<span>></span>
</li>
</ul>
<img src="image/T1vWdTBKDv1RXrhCrK.jpg" alt="" />
</div>
</div>
</template>
<script>
export default {
name: "Banner",
data() {
return {
list: [
"手机 平板",
"电视 盒子",
"路由器 智能配件",
"移动电源 插线板",
"耳机 音箱",
"电池 存储卡",
"保护套 后盖",
"贴膜 其它配件",
"米兔 服装",
"背包 其它周边",
],
};
},
};
</script>
<style scoped lang='scss'>
.banner {
width: 1100px;
height: 500px;
padding: 0 30px;
box-sizing: border-box;
margin: 0 auto;
.box {
position: relative;
img {
width: 1040px;
height: 500px;
}
ul {
position: absolute;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 220px;
height: 500px;
box-sizing: border-box;
background-color: rgba(61, 60, 60, 0.8);
color: #fff;
cursor: pointer;
font-size: 13px;
padding: 15px 0;
li {
padding: 10px;
padding-left: 20px;
span {
display: block;
font-size: 20px;
}
}
li:hover {
background-color: rgba(168, 51, 2, 0.2);
}
}
}
}
</style>
Bootentry.vue
<template>
<div class="bootentry flex j-s">
<ul class="list flex a-c">
<li v-for="(item, index) in list" :key="index" class="item flex">
{{ item.title }}
<span>{{ item.content }}</span>
</li>
</ul>
<div><img src="/image/T184E_BQWT1RXrhCrK.jpg" alt="" /></div>
<div><img src="/image/T1yvd_BQDT1RXrhCrK.jpg" alt="" /></div>
<div><img src="/image/T1mahQBmKT1RXrhCrK.jpg" alt="" /></div>
</div>
</template>
<script>
export default {
name: "Bootentry",
data() {
return {
list: [
{
title: "START",
content: "开放购买",
},
{
title: "GROUND",
content: "企业团购",
},
{
title: "RETROFIT",
content: "官方产品",
},
{
title: "CHANNEL",
content: "F码通道",
},
{
title: "RECHARGE",
content: "话费充值",
},
{
title: "SECURITY",
content: "防伪检查",
},
],
};
},
};
</script>
<style scoped lang='scss'>
.bootentry {
width: 1040px;
height: 180px;
margin: 0 auto;
margin-top: 10px;
box-sizing: border-box;
font-size: 13px;
.list {
width: 220px;
height: 180px;
background-color: #5f5750;
color: white;
flex-wrap: wrap;
justify-content: space-between;
.item {
flex-direction: column;
width: 67px;
height: 55px;
align-items: center;
justify-content: space-between;
margin: 0 2px 5px 0;
span {
border: none;
}
}
:first-child {
border-right: 1px solid #888;
border-bottom: 1px solid #888;
}
:nth-child(2) {
border-right: 1px solid #888;
border-bottom: 1px solid #888;
border-left: 1px solid #888;
}
:nth-child(3) {
border-bottom: 1px solid #888;
border-left: 1px solid #888;
}
:nth-child(4) {
border-top: 1px solid #888;
border-right: 1px solid #888;
padding: 10px 0 0 0;
}
:nth-child(5) {
border-top: 1px solid #888;
border-right: 1px solid #888;
border-left: 1px solid #888;
padding: 10px 0 0 0;
}
:last-child {
border-top: 1px solid #888;
border-left: 1px solid #888;
padding: 10px 0 0 0;
}
}
img {
height: 180px;
width: 260px;
}
}
</style>
<template>
<div class="footer">
<div class="title">
<ul class="flex">
<li>1小时快修服务</li>
<li>|</li>
<li>7天无理由退货</li>
<li>|</li>
<li>15天免费换货</li>
<li>|</li>
<li>满150元包邮</li>
<li>|</li>
<li>520余家售后网点</li>
</ul>
</div>
<div class="nav flex a-c">
<div class="left flex">
<ul>
<li>帮助中心</li>
<li>购物指南</li>
<li>支付方式</li>
<li>配送方式</li>
</ul>
<ul>
<li>服务支持</li>
<li>售后政策</li>
<li>自助服务</li>
<li>相关下载</li>
</ul>
<ul>
<li>大米之家</li>
<li>大米之家</li>
<li>服务网点</li>
<li>预约亲临到店服务</li>
</ul>
<ul>
<li>关注我们</li>
<li>新浪微博</li>
<li>大米部落</li>
<li>官方微信</li>
</ul>
</div>
<div class="right">
<p>400-100-5678</p>
<p>周一至周日 8:00-18:00</p>
<p>(仅收市话费)</p>
<p>24小时在线客服</p>
</div>
</div>
<div class="last flex">
<div class="logo">
<img src="/image/mi-logo.png" alt="" />
</div>
<p>
大米网|MIUI|米聊|多看书城|大米路由器|大米后院|大米天猫店|大米淘宝直营店|大米网盟|问题反馈|Select
Region 5555555号
</p>
</div>
</div>
</template>
<script>
export default {
name: "Footer",
};
</script>
<style scoped lang='scss'>
.footer {
width: 1150px;
margin: 0 auto;
height: 320px;
.title {
width: 90%;
margin: 0px auto;
border-bottom: 1px solid #bebebe;
cursor: pointer;
height: 65px;
color: #9d9d9d;
ul {
width: 900px;
height: 80px;
margin: 0 auto;
align-items: center;
justify-content: center;
li {
margin: 10px;
padding-right: 10px;
}
}
}
.nav {
width: 90%;
height: 170px;
margin: 10px auto;
.left {
width: 70%;
padding: 10px 80px;
color: #bebebe;
ul {
width: 25%;
margin-left: 20px;
li {
margin-top: 10px;
font-size: 13px;
color: gray;
cursor: pointer;
}
:first-child {
color: black;
font-weight: bold;
font-size: 14px;
margin-bottom: 25px;
}
}
}
.right {
width: 20%;
height: 100px;
border-left: 1px solid #ccc;
box-sizing: border-box;
p {
text-align: center;
font-size: 12px;
margin-bottom: 2px;
}
p:hover {
text-decoration: underline;
}
:first-child {
font-size: 16px;
color: #ff7600;
font-weight: bold;
margin-bottom: 4px;
}
:last-child {
width: 90px;
margin: 10px auto;
border: 1px solid #ff7600;
padding: 5px;
color: #ff7600;
background-color: #fff;
font-weight: bold;
}
:last-child:hover {
background-color: #ff7600;
text-decoration: none;
color: white;
}
}
}
.last {
width: 90%;
height: 50px;
margin: 10px auto;
background-color: #fafafa;
color: #757575;
.logo {
width: 30px;
height: 30px;
background-color: #ff6700;
img {
width: 30px;
height: 30px;
}
}
p {
font-size: 13px;
margin-left: 5px;
}
}
}
</style>
Hardware.vue
<template>
<div class="hardware">
<p>智能硬件</p>
<div class="flex j-s">
<div class="left">
<img src="/image/T1IhLjBC_T1RXrhCrK.jpg" alt="" />
</div>
<div class="flex j-s right">
<div v-for="(item, index) in hardware" :key="index">
<img :src="item.imgsrc" alt="" />
<p>{{ item.title }}</p>
<p>{{ item.desc }}</p>
<p>{{ item.price }}</p>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "Hardware",
props: ["hardware"],
};
</script>
<style scoped lang='scss'>
.hardware {
margin: 0 auto;
height: 700px;
width: 1150px;
background-color: #f5f5f5;
padding: 20px 30px;
box-sizing: border-box;
p {
margin-bottom: 10px;
color: #424242;
font-weight: bold;
}
.left {
width: 19%;
}
.right {
width: 78%;
flex-wrap: wrap;
align-items: center;
div {
width: 24%;
height: 302px;
background-color: #ffffff;
padding: 0 2px;
img {
margin: 0 auto;
display: block;
margin-bottom: 20px;
}
:nth-child(2) {
font-size: 14px;
text-align: center;
}
:nth-child(3) {
font-size: 13px;
text-align: center;
color: #bebebe;
}
:last-child {
color: #ff7600;
text-align: center;
}
}
}
}
</style>
Header.vue
<template>
<div class="header flex j-s a-c">
<div class="left">
<ul class="flex">
<li v-for="(item, index) in list1" :key="index" class="item">
<span>{{ item }}</span> |
</li>
</ul>
</div>
<div class="right">
<ul class="flex">
<li class="submit">登录 | 注册</li>
<li class="shopping">购物车(0)</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "Header",
data() {
return {
list1: [
"大米网",
"MIUI",
"米聊",
"游戏",
"多看阅读",
"云服务",
"大米移动版",
"问题反馈",
"Select Region",
],
};
},
};
</script>
<style scoped lang='scss'>
.header {
height: 40px;
background-color: #333;
color: #b0b0b0;
margin: 0 auto;
width: 1150px;
.left {
font-size: 12px;
margin-left: 45px;
cursor: pointer;
span {
margin: 0 10px;
}
span:hover {
color: white;
}
}
.right {
font-size: 15px;
margin-right: 17px;
cursor: pointer;
.submit:hover {
color: white;
}
.shopping:hover {
color: white;
}
:first-child {
margin-right: 30px;
}
}
}
</style>
Hotgoods.vue
<template>
<div class="hotgoods">
<div class="title flex j-s">
<p>大米明星单品</p>
<div class="flex">
<div class="lt"><</div>
<div class="gt">></div>
</div>
</div>
<div class="content flex j-s">
<div v-for="(item, index) in hotgoods" :key="index">
<img :src="item.imgsrc" />
<p>{{ item.title }}</p>
<p>{{ item.desc }}</p>
</div>
</div>
</div>
</template>
<script>
export default {
name: "Hotgoods",
props: ["hotgoods"],
};
</script>
<style scoped lang='scss'>
.hotgoods {
width: 1040px;
height: 280px;
margin: 10px auto;
box-sizing: border-box;
.title {
margin-bottom: 10px;
.lt {
width: 40px;
height: 20px;
text-align: center;
margin-right: 5px;
border: 1px solid #f0f0f0;
color: #bebebe;
cursor: pointer;
}
.gt {
width: 40px;
height: 20px;
text-align: center;
color: #bebebe;
border: 1px solid #f0f0f0;
cursor: pointer;
}
}
.content {
div {
width: 19%;
border-top: 1px solid #ff7600;
background-color: #fafafa;
img {
margin: 0 auto;
display: block;
}
:nth-child(2) {
color: #333;
font-size: 14px;
text-align: center;
margin: 10px 0 15px 0;
}
:last-child {
color: #b0b0b0;
font-size: 13px;
text-align: center;
}
}
}
}
</style>
Menu.vue
<template>
<div class="menu flex j-s a-c">
<div><img src="/image/xiaomi_logo.png" alt="" /></div>
<div>
<ul class="list flex">
<li v-for="(item, index) in menu" :key="index" class="item">
{{ item }}
</li>
</ul>
</div>
<div class="flex">
<input type="text" />
<p>GO</p>
</div>
</div>
</template>
<script>
export default {
name: "Menu",
data() {
return {
menu: [
"大米手机",
"红米",
"平板",
"电视",
"盒子",
"路由器",
"智能硬件",
"服务",
"社区",
],
};
},
};
</script>
<style scoped lang='scss'>
.menu {
width: 1100px;
height: 50px;
padding: 40px 30px;
margin: 0 auto;
box-sizing: border-box;
.list {
margin-left: 80px;
.item {
margin: 10px;
cursor: pointer;
}
.item:hover {
color: #ff6700;
}
}
input {
height: 40px;
border: 1px solid #f0f0f0;
}
p {
width: 40px;
height: 40px;
font-size: 20px;
border: 1px solid #f0f0f0;
text-align: center;
font-weight: bold;
line-height: 40px;
cursor: pointer;
}
}
</style>
store index.js
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
hotgoods: [{
"imgsrc": "image/T1riKjB7VT1RXrhCrK.jpg",
"title": "大米电视2/2S 全系列",
"desc": "40/48/49/55英寸 现货购买"
},
{
"imgsrc": "image/T19AbjBCDT1RXrhCrK.jpg",
"title": "大米平板",
"desc": "全球首款 NVIDIA Tegra K1 平板"
},
{
"imgsrc": "image/T1meZjBCAT1RXrhCrK.jpg",
"title": "大米盒子增强版 1G",
"desc": "首款4K超高清网络机顶盒"
},
{
"imgsrc": "image/T1tsEgB7DT1RXrhCrK.jpg",
"title": "全新大米路由器",
"desc": "顶配路由器,企业级性能"
},
{
"imgsrc": "image/T10TJjB5hT1RXrhCrK.jpg",
"title": "大米头戴式耳机",
"desc": "媲美主流千元级头戴耳机"
}
],
hardware: [{
"imgsrc": "image/T1odEjB5bT1RXrhCrK.jpg",
"title": "大米智能家庭套装",
"desc": "3分钟快速安装,30多种智能玩法",
"price": "199元"
},
{
"imgsrc": "image/T1JKxvBXhv1RXrhCrK.jpg",
"title": "大米随身WIFI 8GB U盘版",
"desc": "随身上网神器,内置8GB U盘",
"price": "49.9元"
},
{
"imgsrc": "image/T18yZQBCET1RXrhCrK.jpg",
"title": "小蚁智能摄像机",
"desc": "能看能听能说,手机远程观看",
"price": "149元"
},
{
"imgsrc": "image/T1YoZQByYT1RXrhCrK.jpg",
"title": "大米体重称",
"desc": "高精度压力传感器 | 手机管理全家健康",
"price": "99元"
},
{
"imgsrc": "image/T16nVjBCKT1RXrhCrK.jpg",
"title": "小蚁运动机",
"desc": "边玩边录边拍,手机随时分享",
"price": "399元"
},
{
"imgsrc": "image/T18zWQB4WT1RXrhCrK.jpg",
"title": "大米路由器 mini",
"desc": "主流双频AC智能路由器,性价比之王",
"price": "129元"
},
{
"imgsrc": "image/T1oixjB5bT1RXrhCrK.jpg",
"title": "大米智能插座",
"desc": "手机远程遥控开关,带USB接口",
"price": "59元"
},
{
"imgsrc": "image/T1KzbQBvbT1RXrhCrK.jpg",
"title": "大米水质TDS检测笔",
"desc": "准确检测家中水质纯度",
"price": "39元"
}
]
},
mutations: {},
actions: {},
modules: {}
})