mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +08:00
30 lines
663 B
Vue
30 lines
663 B
Vue
|
<template>
|
||
|
<div class="demo-image">
|
||
|
<div v-for="fit in fits" :key="fit" class="block">
|
||
|
<span class="demonstration">{{ fit }}</span>
|
||
|
<el-image
|
||
|
style="width: 100px; height: 100px"
|
||
|
:src="url"
|
||
|
:fit="fit"
|
||
|
></el-image>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
import { defineComponent, reactive, toRefs } from 'vue'
|
||
|
|
||
|
export default defineComponent({
|
||
|
setup() {
|
||
|
const state = reactive({
|
||
|
fits: ['fill', 'contain', 'cover', 'none', 'scale-down'],
|
||
|
url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
|
||
|
})
|
||
|
|
||
|
return {
|
||
|
...toRefs(state),
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
</script>
|