<template>
  <div>
    <el-main>
      <el-row>
        <el-col :span="8">
          <el-card v-for="good in goodList" style="width: 500px">
            <el-descriptions :data="good" title="商品列表">
              <el-descriptions-item label="商品图片">
                <img :src="good.image" style="width: 100px" height="100px">
              </el-descriptions-item>
              <el-descriptions-item label="商品名称">{{ good.name }}</el-descriptions-item>
              <el-descriptions-item label="销量">
                1000
              </el-descriptions-item>
              <el-descriptions-item label="备注">
                <el-tag size="small">电子产品</el-tag>
              </el-descriptions-item>
              <el-descriptions-item label="产地">
                江苏省苏州市吴中区吴中大道 1188 号
              </el-descriptions-item>
              <el-descriptions-item>
                <el-button type="primary" size="small" @click="details1(good.id)">详情</el-button>
              </el-descriptions-item>
            </el-descriptions>
          </el-card>
        </el-col>
      </el-row>
    </el-main>

    <el-main>
      <el-row :gutter="20">
        <el-col :span="12" :offset="6">
          <router-view></router-view>
        </el-col>
      </el-row>
    </el-main>


  </div>
</template>
<script>

import {getPro, listInfo} from "@/api/product/info";

export default {
  name: 'Index',
  computed: {},
  data() {
    return {
      goodList: [],
      queryParams: {},
    }
  },
  created() {
    this.getList()
  },

  methods: {
    details1(id) {
      this.$router.push('/detailsComponent/' + id)
    },
    /*获取商品信息*/
    getList() {
      this.loading = true;
      listInfo(this.queryParams).then(response => {
        this.goodList = response.data.rows;
        console.log(this.goodList)
      });
    },
  }
}
</script>
<style scoped>
.like {
  cursor: pointer;
  font-size: 12px;
  display: inline-block;
}

.el-carousel__item h3 {
  color: #475669;
  font-size: 20px;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
}

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

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
</style>
