Element-ui Image 图片
原文链接:https://note.noxussj.top/?source=sifo
在原生图片的根底上做了二次封装,扩大了更多功能。
按需引入形式
如果是残缺引入可跳过此步骤
import Vue from 'vue'
import {Image} from 'element-ui'
import 'element-ui/lib/theme-chalk/base.css'
import 'element-ui/lib/theme-chalk/image.css'
Vue.use(Image)
根底应用
<template>
<div class="block" v-for="fit in fits" :key="fit">
<span class="demonstration">{{fit}}</span>
<el-image style="width: 100px; height: 100px" :src="url" :fit="fit"></el-image>
</div>
</template>
<script>
export default {data() {
return {fits: ['fill', 'contain', 'cover', 'none', 'scale-down'],
url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
}
}
}
</script>
大图预览
<template>
<div class="demo-image__preview">
<el-image style="width: 100px; height: 100px" :src="url" :preview-src-list="srcList"> </el-image>
</div>
</template>
<script>
export default {data() {
return {
url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
srcList: [
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
]
}
}
}
</script>
Tabs Attributes
原文链接:https://note.noxussj.top/?source=sifo