默认图
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, reactive, toRefs } from 'vue'
|
||||
import nullImg from '@/assets/images/shopping-cart-null.png'
|
||||
const props = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
@@ -42,7 +41,7 @@
|
||||
</script>
|
||||
<template>
|
||||
<div class="commodity-item" :class="{ 'is-download': download }">
|
||||
<img :src="nullImg" v-loadimg="props.url" alt="" @click="openDetail" />
|
||||
<img v-loadimg="props.url" alt="" @click="openDetail" />
|
||||
<div class="detail">
|
||||
<div class="text">
|
||||
<div class="name">
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import img from '@/assets/images/shopping-cart-null.png'
|
||||
// 加载图片
|
||||
export default {
|
||||
name: 'loadimg',
|
||||
beforeMount(el, binding) {
|
||||
if (!el.src) el.src = img
|
||||
},
|
||||
mounted(el, binding) {
|
||||
const src = binding.value
|
||||
if (el.src === src) return
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
}"
|
||||
>
|
||||
<slot name="checkbox" />
|
||||
<img :src="info.cover" />
|
||||
<img v-loadimg="info.cover" />
|
||||
<div class="content">
|
||||
<div class="title">{{ info.title }}</div>
|
||||
<div class="brand" v-if="showBrand" @click="handleBrandClick">
|
||||
|
||||
Reference in New Issue
Block a user