<view class="container">
    <image class="centered-image" src="/path/to/your/image.png"></image>
</view>

<style lang="scss">
.container {
    display: flex;
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    width: 100%; /* 假设要占满父容器的宽度 */
    height: 100%; /* 假设要占满父容器的高度 */
}

.centered-image {
    max-width: 100%; /* 可根据需要设置图片的最大宽度 */
    max-height: 100%; /* 可根据需要设置图片的最大高度 */
}
</style>

更多推荐