mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-15 19:41:06 +08:00

* fix(components): [skeleton] `throttle` property not working * fix: lint fix * feat: add func & doc & test * feat: remove test modify * feat: increase document examples, improve document descriptions * fix(components): [skeleton] `throttle` property not working * fix: lint fix * feat: add func & doc & test * feat: remove test modify * feat: increase document examples, improve document descriptions * feat: 重构`useThrottleRender`钩子以提高代码可读性和效率 - 简化了对`throttle`参数的判断逻辑,通过`isNumber`函数判断是否为数字 - 将`leadingDispatch`和`trailingDispatch`函数合并为`dispatcher`函数,根据传入的类型判断执行逻辑 - 优化了`watch`回调函数,使用`dispatcher`函数替代重复的判断逻辑 * feat: 写法优化 * feat: 引入`isObject`函数替代原有的`typeof throttle === 'object'`判断方式 * feat: 优化骨架屏文档结构和示例 * feat: 完善文字描述和修改对应的文件名 * Update docs/en-US/component/skeleton.md Co-authored-by: btea <2356281422@qq.com> * Update docs/en-US/component/skeleton.md Co-authored-by: btea <2356281422@qq.com> * feat: Optimize code writing * Update docs/en-US/component/skeleton.md Co-authored-by: btea <2356281422@qq.com> * Update docs/en-US/component/skeleton.md * feat: modify doc * feat: md * feat: 补充 useThrottleRender 钩子的测试用例 * feat: 将 SkeletonThrottle 类型移动到hook中, 重命名为 ThrottleType 以提高通用性 --------- Co-authored-by: btea <2356281422@qq.com>
56 lines
1.7 KiB
Vue
56 lines
1.7 KiB
Vue
<template>
|
|
<el-space direction="vertical" alignment="flex-start">
|
|
<div>
|
|
<label style="margin-right: 16px">Switch Loading</label>
|
|
<el-switch v-model="loading" />
|
|
</div>
|
|
<el-skeleton
|
|
style="width: 240px"
|
|
:loading="loading"
|
|
animated
|
|
:throttle="{ leading: 500, trailing: 500, initVal: true }"
|
|
>
|
|
<template #template>
|
|
<el-skeleton-item variant="image" style="width: 240px; height: 265px" />
|
|
<div style="padding: 14px">
|
|
<el-skeleton-item variant="h3" style="width: 50%" />
|
|
<div
|
|
style="
|
|
display: flex;
|
|
align-items: center;
|
|
justify-items: space-between;
|
|
margin-top: 16px;
|
|
height: 16px;
|
|
"
|
|
>
|
|
<el-skeleton-item variant="text" style="margin-right: 16px" />
|
|
<el-skeleton-item variant="text" style="width: 30%" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<template #default>
|
|
<el-card :body-style="{ padding: '0px', marginBottom: '1px' }">
|
|
<img
|
|
src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
|
|
class="image"
|
|
/>
|
|
<div style="padding: 14px">
|
|
<span>Delicious hamburger</span>
|
|
<div class="bottom card-header">
|
|
<div class="time">{{ currentDate }}</div>
|
|
<el-button text class="button">operation button</el-button>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</template>
|
|
</el-skeleton>
|
|
</el-space>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
|
|
const loading = ref(false)
|
|
const currentDate = new Date().toDateString()
|
|
</script>
|