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

57 lines
1.3 KiB
Vue
Raw Normal View History

2017-11-09 10:57:34 +00:00
<script>
2018-01-26 05:48:20 +00:00
import Basic from './basic'
import Badge from './badge'
import Type from './type'
import Dynamic from './dynamic'
import CN from '../index.zh-CN.md'
import US from '../index.en-US.md'
const md = {
cn: `# Avatar头像
用来代表用户或事物支持图片图标或字符展示
## 代码演示`,
us: `# Avatar
Avatars can be used to represent people or objects. It supports images, 'Icon's, or letters.
`,
}
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
},
},
2018-01-26 05:48:20 +00:00
render () {
return (
<div>
<md cn={md.cn} us={md.us}/>
<Basic/>
<br/>
<Badge/>
<br/>
<Type/>
<br/>
2018-01-28 12:30:25 +00:00
<Dynamic/>
<br/>
2018-01-26 05:48:20 +00:00
<api>
<template slot='cn'>
<CN/>
</template>
<US/>
</api>
</div>
)
},
2017-11-09 10:57:34 +00:00
}
</script>