第五章-封装PC端官网卡片组件

<template>
  <div>
    <!-- 列表 -->
    <div class="lw-card-box">
      <div class="lw-card-view">
        <el-row :gutter="20">
          <!-- 注意这里的if判断是指限制显示几个 -->
          <el-col
            :span="6"
            v-for="(item, index) in hospitalList"
            :key="index"
            v-if="index < hcount"
            >
            <!-- 卡片 -->
            <div class="lw-card-items" @click="getHospital(item, city, 1)">
              <!-- 图片 -->
              <img class="lw-card-img" :src="item.img" />
              <!-- 昵称 -->
              <div class="lw-card-name">{{ item.name }}</div>
              <!-- 标签 -->
              <div class="lw-card-label-box">
                <label
                  style="margin-right: 5px"
                  v-for="items in item.label"
                  :key="items"
                  >{{ items }}</label
                >
              </div>
              <!-- icon -->
              <div class="lw-card-address">
                <img src="~/assets/img/all/addres.png" /> {{ item.address }}
              </div>
            </div>
          </el-col>
          <!-- 这里v-show区分显示更多 -->
          <el-col :span="6" v-show="show"
            ><div class="lw-card-items" @click="getHospital('', city, 2)">
              <img class="lw-card-img" src="~/assets/img/all/none.png" />
              <div class="lw-card-more">
                更多{{ city }}医院
                <img src="~/assets/img/all/rightradio.png" alt="" title="" />
              </div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["hospitalList", "hcount", "city", "show"],
  data() {
    return {};
  },
  methods: {
    getHospital(item, city, type) {
      this.$emit("getHospital", item, city, type);
    },
  },
};
</script>
<style scoped>
.lw-items:hover {
  font-size: 20px;
  font-family: MicrosoftYaHei;
  color: #3878f8 !important;
  cursor: pointer;
}
.lw-card-items:hover {
  box-shadow: 0px 0px 18px 0px rgba(0, 0, 0, 0.12);
}
.lw-card-box {
  width: 1200px;
  display: inline-block;
}
.lw-card-name {
  font-size: 16px;
  font-family: MicrosoftYaHei;
  color: #222222;
  height: 30px;
  padding-left: 10px;
  line-height: 30px;
  text-align: left;
  margin-top: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lw-card-label-box {
  text-align: left;
  overflow: hidden;
  padding-left: 11px;
  margin-bottom: 5px;
}
.lw-card-label-box label {
  width: 60px;
  height: 22px;
  line-height: 22px;
  font-size: 12px;
  font-family: MicrosoftYaHei;
  color: #3878f8;
  text-align: center;
  display: inline-block;
  font-size: 13px;
  border-radius: 2px;
  border: 1px solid #3878f8;
}
.lw-card-address {
  padding-left: 6px;
  height: 30px;
  overflow: hidden;
  width: 262px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-family: MicrosoftYaHei;
  color: #9ca2ae;
  line-height: 30px;
}
.lw-card-address img {
  width: 24px;
  display: inline-block;
  position: relative;
  bottom: 2px;
  height: 24px;
}
.lw-card-view {
  width: 100%;
  margin: 0 auto;
  display: inline-block;
}
.lw-card-img {
  width: 100%;
  height: 204px;
  border-radius: 4px 4px 0px 0px;
}
.moreText {
  position: absolute;
  right: 0;
  width: 30px;
  justify-content: center;
  align-items: center;
  display: inline-block;
  top: 30%;
  color: #999;
  line-height: 20px;
}
.lw-card-more {
  width: 100%;
  text-align: center;
  position: relative;
  display: inline-block;
  height: 140px;
  font-size: 18px;
  color: #3878f8;
  line-height: 140px;
}
.lw-card-more img {
  width: 20px;
  height: 20px;
  position: relative;
  bottom: 1px;
}
.lw-card-items {
  text-align: center;
  height: 332px;
  margin-bottom: 20px;
  position: relative;
  background: #fff;
  cursor: pointer;
  border-radius: 4px;
  padding-bottom: 15px;
}
</style>

<template>
  <div class="hospital-view">
 
    <!-- 医院card -->
    <div>
      <LwCardList
        :hcount="16"
        :show="false"
        :hospitalList="hospitalList"
      ></LwCardList>
    </div>
    <!-- end -->
     <!-- 分页 -->
    <div class="paginationbox" >
      <v-page
        :page="page"
        :total="total"
        :rows="rows"
        @handleSize="handleSize"
        @handleCurrent="handleCurrent"
      ></v-page>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
        page:1,
        total:200,
      hospitalList: [
        {
          value: 1,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 2,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 3,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 4,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 5,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 6,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 7,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 8,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
        {
          value: 9,
          label: ["三甲医院", "私立医院"],
          img: "",
          name: "中国人民解放军总医院(301)",
          address: "天津市河北区天泰路130号天津市河北区天泰路130号",
        },
      ],

    };
  },
  methods: {
       /**
     * 每页显示条数事件
     */
    handleSize(val) {
      console.log("handleSize", val);
    },
    /**
     * 切换页数
     */
    handleCurrent(val) {
      console.log("handleCurrent", val);
    },
    /**
     *点击选中卡片数据
     * @param {item} 当前选中数据
     */
     getHospital(item, city, type) {
      console("getHospital", item, city, type);
    },
    },
  },
};
</script>
<style scoped>
/* 最外层 */
.hospital-view {
  width: 100%;
  height: 100%;
  background: #f6f7fa;
  text-align: center;
}

</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

菜鸟老五

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值