uniapp中如何通过css实现圆形头像样式

核心代码:

css 复制代码
	#top-card .top image{
		width: 60rpx;
		height: 60rpx;
		border-radius: 30rpx;
	}

关键知识点:宽高相同,圆角值为宽高值的一半。

修改之前的效果:

修改之后的效果:

完整代码:

html 复制代码
<script setup>
	import {
		onMounted,
		ref
	} from 'vue';
	const src = "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg"
	const data = ref([])

	onMounted(() => {
		uni.request({
			method: "GET",
			url: 'http://192.168.234.138:8889/zdppy_amfile',
			dataType: "json",
			success: (res) => {
				console.log(res.data);
				data.value = res.data.data.results
			}
		})
	})
</script>

<template>
	<view class="content">
		<view id="top-card">
			<view class="top">
				<image src="../../static/boy1.png"></image>
				<view>测试名字</view>
			</view>
			<view class="bottom">
				<button>查找照片</button>
				<button>亲友团</button>
			</view>
		</view>


		<view class="img-list">
			<image v-for="(v,k) in data" :key="k" :src="`http://192.168.234.138:8889/download/${v.path}`"
				mode="aspectFill" />
		</view>
	</view>
</template>



<style scoped>
	.content {
		margin: auto;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	/* 顶部卡片开始 */
	#top-card {
		margin-bottom: 10rpx;
		background-color: aliceblue;
	}

	#top-card .top {
		display: flex;
	}
	
#top-card .top image{
		width: 60rpx;
		height: 60rpx;
		border-radius: 30rpx;
	}

	#top-card .bottom {
		display: flex;
	}

	/* 顶部卡片结束 */

	.img-list {
		padding: 10rpx;
		column-count: 2;
		column-gap: 10rpx;
	}
</style>
相关推荐
labixiong6 分钟前
还原一个完整符合规范的 Promise(二)
前端·javascript
时光足迹14 分钟前
腾讯云 TRTC UniApp SDK 从入门到上线
前端·vue.js·uni-app
时光足迹24 分钟前
uni-app 里把加密视频嵌入页面播放?我分析了 4 种方案,只有 1 种接近完美
前端·vue.js·uni-app
时光足迹39 分钟前
JPush UniApp UTS 插件完全参考手册:API、事件与厂商通道一网打尽
vue.js·ios·uni-app
时光足迹1 小时前
极光推送全攻略(下):uni-app 代码实现与 iOS 排查实战
vue.js·ios·uni-app
To_OC1 小时前
万字解析《JS 语言精粹》之第五章:继承 5 大核心精髓(JS 原型核心)
前端·javascript·代码规范
时光足迹1 小时前
极光推送全攻略(上):被iOS证书折磨了三天,我写了一份前端也能看懂的避坑指南
前端·ios·uni-app
DyLatte1 小时前
AI 时代,最危险的不是被替代,而是努力不沉淀
前端·后端·程序员
mCell2 小时前
【锐评】桌面端技术营销:别拿跑分当工程判断
前端·rust·electron
柒和远方2 小时前
从一次工程审查看 AI 学习产品的边界兜底:RAG 资料链路一致性实战
前端·后端·架构