1 line
6.2 KiB
JSON
1 line
6.2 KiB
JSON
|
{"ast":null,"code":"//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport search from \"../../components/Search\";\nexport default {\n name: \"TopView\",\n data: function data() {\n return {\n //轮播图\n carousels: [],\n //推荐商品\n good: [],\n //分类icon,每个icon包含id、value、categories对象数组.category:id,name\n icons: [],\n //搜索内容\n searchText: ''\n };\n },\n components: {\n search: search\n },\n created: function created() {\n var _this = this;\n\n this.request.get(\"/api/good\").then(function (res) {\n if (res.code === '200') {\n _this.good = res.data;\n } else {\n _this.$message.error(res.msg);\n }\n });\n this.request.get(\"/api/icon\").then(function (res) {\n if (res.code === '200') {\n _this.icons = res.data;\n }\n });\n this.request.get(\"/api/carousel\").then(function (res) {\n if (res.code === '200') {\n _this.carousels = res.data;\n }\n });\n },\n methods: {\n handleSearch: function handleSearch(text) {\n this.searchText = text;\n this.$router.push({\n path: '/goodList',\n query: {\n searchText: this.searchText\n }\n });\n }\n }\n};","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA;AACA;AACAA,iBADA;AAEAC,MAFA,kBAEA;AACA;AACA;AACAC,mBAFA;AAGA;AACAC,cAJA;AAMA;AACAC,eAPA;AAQA;AACAC;AATA;AAWA,GAdA;AAeAC;AACAC;AADA,GAfA;AAkBAC,SAlBA,qBAkBA;AAAA;;AACA;AACA;AACA;AACA,OAFA,MAEA;AACA;AACA;AACA,KANA;AAQA;AACA;AACA;AACA;AACA,KAJA;AAKA;AACA;AACA;AACA;AACA,KAJA;AAKA,GArCA;AAsCAC;AACAC,gBADA,wBACAC,IADA,EACA;AACA;AACA;AAAAC;AAAAC;AAAAR;AAAA;AAAA;AACA;AAJA;AAtCA","names":["name","data","carousels","good","icons","searchText","components","search","created","methods","handleSearch","text","path","query"],"sourceRoot":"src/views/front","sources":["TopView.vue"],"sourcesContent":["<template>\r\n<div>\r\n\r\n <search @search=\"handleSearch\"></search>\r\n\r\n <div class=\"main-box\">\r\n\r\n <div class=\"block\" style=\"width: 1200px ;margin: 10px auto\">\r\n<!-- 类别菜单-->\r\n <div class=\"good-menu\">\r\n <ul v-for=\"(item,index) in icons\" :key=\"index\">\r\n <li>\r\n <i class=\"iconfont\" v-html=\"item.value\"></i>\r\n <!-- 跳转到goodList页面,参数为类别id-->\r\n <router-link :to=\"{path: '/goodlist',query: {categoryId: item.categories[0].id }}\">\r\n <a href=\"/person\"><span>{{ item.categories[0].name }}</span></a>\r\n </router-link>\r\n <span> / </span>\r\n <router-link :to=\"{path: '/goodList',query: {categoryId: item.categories[1].id}}\">\r\n <a href=\"/person\"><span>{{ item.categories[1].name}}</span></a>\r\n </router-link>\r\n </li>\r\n </ul>\r\n </div>\r\n <!--轮播图-->\r\n <div>\r\n <el-carousel height=\"370px\" style=\"border-radius:20px;width: 600px\">\r\n <el-carousel-item v-for=\"carousel in carousels\" :key=\"carousel.id\">\r\n <router-link :to=\"'/goodview/'+carousel.goodId\">\r\n <img style=\"height: 370px;width: 600px;\" :src=\"carousel.img\"/>\r\n </router-link>\r\n </el-carousel-item>\r\n </el-carousel>\r\n </div>\r\n\r\n </div>\r\n\r\n <!--推荐商品-->\r\n <div style=\"margin-top: 30px\">\r\n <span style=\"color: #ff5e5e\">推荐商品</span>\r\n </div>\r\n\r\n <div style=\"width: 1300px;margin: 20px auto;\">\r\n <el-row :gutter=\"20\">\r\n <el-col :span=\"6\" v-for=\"good in good\" :key=\"good.id\" style=\"margin-bottom: 20px \">\r\n <router-link :to=\"'goodview/'+good.id\">\r\n <el-card :body-style=\"{ padd
|