懒加载占位图可配置

This commit is contained in:
tangly1024.com
2023-07-24 14:33:43 +08:00
parent 62772a9485
commit 0070ba1b44
2 changed files with 3 additions and 16 deletions

View File

@@ -1,21 +1,7 @@
import BLOG from '@/blog.config'
import Head from 'next/head'
import React, { useEffect, useRef, useState } from 'react'
/**
* 默认懒加载占位图
*/
const loadingSVG = (
<svg
width="100"
height="100"
viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg"
fill="#ccc"
>
<circle cx="50" cy="50" r="42" strokeWidth="8" />
</svg>
)
/**
* 图片懒加载
* @param {*} param0
@@ -26,7 +12,7 @@ export default function LazyImage({
id,
src,
alt,
placeholderSrc = loadingSVG,
placeholderSrc = BLOG.IMG_LAZY_LOAD_PLACEHOLDER,
className,
width,
height,