主要是设置mode="widthFix"和width: 100%;
<!-- 新手教程 -->
<template>
<div class="center-tutorial">
<img class="img" src="https://123.oss-cn-hangzhou.aliyuncs.com/666.jpeg" mode="widthFix">
</div>
</template>
<style lang="less" scoped>
.center-tutorial {
.img {
width: 100%;
}
}
</style>
本文主要介绍了如何在前端开发中实现图片的宽度自适应显示,通过设置mode=widthFix和width:100%;属性,使图片能够在不同屏幕尺寸下保持良好的视觉效果。
1501





