element-plus/docs/examples/avatar/basic.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

66 lines
1.7 KiB
Vue

<template>
<el-row class="demo-avatar demo-basic">
<el-col :span="12">
<div class="sub-title">circle</div>
<div class="demo-basic--circle">
<div class="block">
<el-avatar :size="50" :src="circleUrl"></el-avatar>
</div>
<div v-for="size in sizeList" :key="size" class="block">
<el-avatar :size="size" :src="circleUrl"></el-avatar>
</div>
</div>
</el-col>
<el-col :span="12">
<div class="sub-title">square</div>
<div class="demo-basic--circle">
<div class="block">
<el-avatar shape="square" :size="50" :src="squareUrl"></el-avatar>
</div>
<div v-for="size in sizeList" :key="size" class="block">
<el-avatar shape="square" :size="size" :src="squareUrl"></el-avatar>
</div>
</div>
</el-col>
</el-row>
</template>
<script lang="ts" setup>
import { reactive, toRefs } from 'vue'
const state = reactive({
circleUrl:
'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
squareUrl:
'https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png',
sizeList: ['large', 'default', 'small'],
})
const { circleUrl, squareUrl, sizeList } = toRefs(state)
</script>
<style scoped>
.demo-basic {
text-align: center;
}
.demo-basic .sub-title {
margin-bottom: 10px;
font-size: 14px;
color: var(--el-text-color-secondary);
}
.demo-basic .demo-basic--circle,
.demo-basic .demo-basic--square {
display: flex;
justify-content: space-between;
align-items: center;
}
.demo-basic .block:not(:last-child) {
border-right: 1px solid getCssVar('border-color');
}
.demo-basic .block {
flex: 1;
}
.demo-basic .el-col:not(:last-child) {
border-right: 1px solid getCssVar('border-color');
}
</style>