123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
-
- <div class="item" @click="handleClick(item)">
- <div class="card-img">
- <img class="full" :src="item.thumb" alt="" />
- <img class="real" :src="item.thumb" alt="" />
- </div>
- <div class="card-txt">
- <div class="title">
- <span :title="item.name">{{ item.name }}</span>
- </div>
- <div class="tag">
- <span :title="item.material">{{ item.material }}</span>
- </div>
- </div>
- </div>
- </template>
- <script>
- import browser from "@/utils/browser.js";
- export default {
- props: ["item"],
- data() {
- return {
- isMobile: browser.mobile
- };
- },
- methods:{
- handleClick(item){
- this.$emit('handleItem',item)
- }
- }
- };
- </script>
- <style lang="less" scoped>
- @margin: 36px;
- .item {
- text-align: center;
- display: inline-block;
- width: calc((100% - @margin * 3) / 4);
- margin-right: @margin;
- margin-bottom: @margin;
- background: #f5ede2;
- border-radius: 8px;
- overflow: hidden;
- cursor: pointer;
- &:nth-of-type(4n) {
- margin-right: 0;
- }
- .card-img {
- width: 310px;
- height: 190px;
- position: relative;
- max-height: 190px;
- overflow: hidden;
- img {
- width: 100%;
- }
- .full {
- opacity: 0;
- }
- .real {
- position: absolute;
- z-index: 99;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- }
- .card-txt {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 16px;
- padding: 8px 10px;
- .tag {
- color: @theme;
- }
- div{
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
- }
- }
- }
- @media screen and (min-width: 500px) and (max-width: 1400px) {
- .item {
- width: calc((100% - @margin * 3) / 3);
- &:nth-of-type(3n) {
- margin-right: 0;
- }
- &:nth-of-type(4n){
- margin-right: @margin;
- }
- }
- }
- @media screen and (max-width: 500px) {
- .item {
- width: 42.4vw;
- margin-right: 5vw;
- margin-bottom: 5vw;
- &:nth-of-type(2n) {
- margin-right: 0;
- }
- // &:nth-of-type(4n){
- // margin-right: @margin;
- // }
- }
- }
- </style>
|