ant-design-vue/components/avatar/demo/index.vue

55 lines
1.6 KiB
Vue
Raw Normal View History

2017-11-09 10:57:34 +00:00
<template>
<div>
<div>
2018-01-23 10:55:39 +00:00
<a-avatar size="large" icon="user"/>
<a-avatar icon="user"/>
<a-avatar size="small" icon="user"/>
2017-11-09 10:57:34 +00:00
</div>
2017-11-16 10:29:02 +00:00
<br/>
2017-11-09 10:57:34 +00:00
<div>
2018-01-23 10:55:39 +00:00
<a-avatar shape="square" size="large" icon="user" />
<a-avatar shape="square" icon="user" />
<a-avatar shape="square" size="small" icon="user" />
2017-11-09 10:57:34 +00:00
</div>
2017-11-16 10:29:02 +00:00
<br/>
2017-11-09 10:57:34 +00:00
<div>
2018-01-23 10:55:39 +00:00
<a-avatar icon="user" />
<a-avatar>U</a-avatar>
<a-avatar>USER</a-avatar>
<a-avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
<a-avatar :styles="{ color: '#f56a00', backgroundColor: '#fde3cf' }">U</a-avatar>
<a-avatar :styles="{ backgroundColor: '#87d068' }" icon="user" />
2017-11-09 10:57:34 +00:00
</div>
2017-11-16 10:29:02 +00:00
<br/>
2017-11-09 10:57:34 +00:00
<div>
2018-01-23 10:55:39 +00:00
<a-avatar shape="square" size="large" :styles="{'backgroundColor': color}">{{avatarValue}}</a-avatar>
<a-button @click="changeValue"></a-button>
2017-11-09 10:57:34 +00:00
</div>
2017-11-16 10:29:02 +00:00
<br/>
<div>
2018-01-23 10:55:39 +00:00
<a-badge count=1><a-avatar shape="square" icon="user" /></a-badge>
2017-11-16 10:29:02 +00:00
<br/>
2018-01-23 10:55:39 +00:00
<a-badge dot><a-avatar shape="square" icon="user" /></a-badge>
2017-11-16 10:29:02 +00:00
</div>
2017-11-09 10:57:34 +00:00
</div>
</template>
<script>
2017-12-20 02:56:21 +00:00
const UserList = ['U', 'Lucy', 'Tom', 'Edward']
const colorList = ['#f56a00', '#7265e6', '#ffbf00', '#00a2ae']
2017-11-09 10:57:34 +00:00
export default {
data () {
return {
2017-12-20 02:56:21 +00:00
avatarValue: UserList[0],
color: colorList[0],
2017-11-09 10:57:34 +00:00
}
},
methods: {
changeValue () {
2017-12-20 02:56:21 +00:00
const index = UserList.indexOf(this.avatarValue)
this.avatarValue = index < UserList.length - 1 ? UserList[index + 1] : UserList[0]
this.color = index < colorList.length - 1 ? colorList[index + 1] : colorList[0]
2017-11-09 10:57:34 +00:00
},
},
}
</script>