Ant-design-pro: 更换页面右上角头像

Created on 22 Nov 2017  ·  2Comments  ·  Source: ant-design/ant-design-pro

在BasicLayout.js里有个
Avatar size="small" className={styles.avatar} src={currentUser.avatar}
显示页面右上角头像,
我在assets目录下新增一个user.png图片.然后这里改成
Avatar size="small" className={styles.avatar} src="../assets/user.png"
图片并没有显示出来.然后各种路径地址我都尝试了,还是无法显示.
请问这里如何使用本地图片作为头像呢?

Most helpful comment

改成src={require('../assets/user.png')}解决了....

All 2 comments

改成src={require('../assets/user.png')}解决了....

也能直接在上面import pic from "../assets/user.png"
将着直接就 src={pic}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lvzheng0404 picture lvzheng0404  ·  3Comments

renyi818 picture renyi818  ·  3Comments

kaoding picture kaoding  ·  3Comments

happier2 picture happier2  ·  3Comments

Yoping picture Yoping  ·  3Comments