element-plus/docs/examples/image/placeholder.vue
云游君 06f6844509
refactor(theme-chalk): rewrite palette & remove -base suffix (#6593)
* refactor(theme-chalk): rewrite palette & remove -base suffix

* refactor(theme-chalk): container as default bg-color

* refactor(theme-chalk): add fill-color-blank

* fix(docs): fill-color-light for code-bg
2022-03-13 20:10:07 +08:00

60 lines
1.3 KiB
Vue

<template>
<div class="demo-image__placeholder">
<div class="block">
<span class="demonstration">Default</span>
<el-image :src="src"></el-image>
</div>
<div class="block">
<span class="demonstration">Custom</span>
<el-image :src="src">
<template #placeholder>
<div class="image-slot">Loading<span class="dot">...</span></div>
</template>
</el-image>
</div>
</div>
</template>
<script lang="ts" setup>
const src =
'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg'
</script>
<style scoped>
.demo-image__placeholder .block {
padding: 30px 0;
text-align: center;
border-right: solid 1px getCssVar('border-color');
display: inline-block;
width: 49%;
box-sizing: border-box;
vertical-align: top;
}
.demo-image__placeholder .demonstration {
display: block;
color: var(--el-text-color-secondary);
font-size: 14px;
margin-bottom: 20px;
}
.demo-image__placeholder .el-image {
padding: 0 5px;
max-width: 300px;
max-height: 200px;
}
.demo-image__placeholder.image-slot {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
background: #f5f7fa;
color: var(--el-text-color-secondary);
font-size: 14px;
}
.demo-image__placeholder .dot {
animation: dot 2s infinite steps(3, start);
overflow: hidden;
}
</style>