-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pro components - trend, avatarList
- Loading branch information
Showing
11 changed files
with
314 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<div> | ||
item | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "AvatarItem", | ||
props: { | ||
tips: { | ||
type: String, | ||
default: '', | ||
required: false | ||
}, | ||
src: { | ||
type: String, | ||
required: true | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<div> | ||
|
||
</div> | ||
</template> | ||
|
||
<script> | ||
import Avatar from 'ant-design-vue/es/avatar' | ||
import AvatarListItem from './Item' | ||
export default { | ||
name: "AvatarList", | ||
components: { | ||
Avatar, | ||
AvatarListItem | ||
}, | ||
props: { | ||
/** | ||
* 头像大小 类型: large、small 、mini, default | ||
* 默认值: default | ||
*/ | ||
size: { | ||
type: String, | ||
default: 'default' | ||
}, | ||
/** | ||
* 要显示的最大项目 | ||
*/ | ||
maxLength: { | ||
type: Number, | ||
default: 3 | ||
}, | ||
/** | ||
* 额外 CSS 风格 | ||
*/ | ||
excessItemsStyle: { | ||
type: Object, | ||
default: () => {} | ||
} | ||
}, | ||
data () { | ||
return { | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import AvatarList from './List' | ||
|
||
export default AvatarList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@import "../index"; | ||
|
||
@avatar-list-prefix-cls: ~"@{ant-pro-prefix}-avatar-list"; | ||
@avatar-list-item-prefix-cls: ~"@{ant-pro-prefix}-avatar-list-item"; | ||
|
||
.@{avatar-list-prefix-cls} { | ||
display: inline-block; | ||
|
||
ul { | ||
display: inline-block; | ||
margin-left: 8px; | ||
font-size: 0; | ||
} | ||
} | ||
|
||
.@{avatar-list-item-prefix-cls} { | ||
display: inline-block; | ||
font-size: @font-size-base; | ||
margin-left: -8px; | ||
width: @avatar-size-base; | ||
height: @avatar-size-base; | ||
|
||
:global { | ||
.ant-avatar { | ||
border: 1px solid #fff; | ||
} | ||
} | ||
|
||
.large { | ||
width: @avatar-size-lg; | ||
height: @avatar-size-lg; | ||
} | ||
|
||
.small { | ||
width: @avatar-size-sm; | ||
height: @avatar-size-sm; | ||
} | ||
|
||
.mini { | ||
width: 20px; | ||
height: 20px; | ||
|
||
:global { | ||
.ant-avatar { | ||
width: 20px; | ||
height: 20px; | ||
line-height: 20px; | ||
|
||
.ant-avatar-string { | ||
font-size: 12px; | ||
line-height: 18px; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<div :class="[prefixCls, reverseColor && 'reverse-color' ]"> | ||
<span> | ||
<slot name="term"></slot> | ||
<span class="item-text"> | ||
<slot></slot> | ||
</span> | ||
</span> | ||
<span :class="[flag]"><a-icon :type="`caret-${flag}`"/></span> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "Trend", | ||
props: { | ||
prefixCls: { | ||
type: String, | ||
default: 'ant-pro-trend' | ||
}, | ||
/** | ||
* 上升下降标识:up|down | ||
*/ | ||
flag: { | ||
type: String, | ||
required: true | ||
}, | ||
/** | ||
* 颜色反转 | ||
*/ | ||
reverseColor: { | ||
type: Boolean, | ||
default: false | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
@import "index"; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Trend from './Trend.vue' | ||
|
||
export default Trend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@import "../index"; | ||
|
||
@trend-prefix-cls: ~"@{ant-pro-prefix}-trend"; | ||
|
||
.@{trend-prefix-cls} { | ||
display: inline-block; | ||
font-size: @font-size-base; | ||
line-height: 22px; | ||
|
||
.up, | ||
.down { | ||
margin-left: 4px; | ||
position: relative; | ||
top: 1px; | ||
|
||
i { | ||
font-size: 12px; | ||
transform: scale(0.83); | ||
} | ||
} | ||
|
||
.item-text { | ||
display: inline-block; | ||
margin-left: 8px; | ||
color: rgba(0,0,0,.85); | ||
} | ||
|
||
.up { | ||
color: @red-6; | ||
} | ||
.down { | ||
color: @green-6; | ||
top: -1px; | ||
} | ||
|
||
&.reverse-color .up { | ||
color: @green-6; | ||
} | ||
&.reverse-color .down { | ||
color: @red-6; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@import "~ant-design-vue/lib/style/index"; | ||
|
||
// The prefix to use on all css classes from ant-pro. | ||
@ant-pro-prefix : ant-pro; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,74 @@ | ||
<template> | ||
<div class="home"> | ||
<img alt="Vue logo" src="../assets/logo.png"> | ||
<HelloWorld msg="Welcome to Your Vue.js App"/> | ||
<div class="banner"> | ||
<img alt="Vue logo" style="width: 64px; height: 64px" src="../assets/logo.png"> | ||
<h3>Welcome to Your Vue.js App</h3> | ||
</div> | ||
|
||
<br/> | ||
|
||
<h2># Trend 组件 </h2> | ||
|
||
<a-divider> 正常 </a-divider> | ||
|
||
<a-card> | ||
|
||
<trend flag="up" style="margin-right: 16px;"> | ||
<span slot="term">工资</span> | ||
5% | ||
</trend> | ||
<trend flag="up" style="margin-right: 16px;"> | ||
<span slot="term">工作量</span> | ||
50% | ||
</trend> | ||
<trend flag="down"> | ||
<span slot="term">身体状态</span> | ||
50% | ||
</trend> | ||
|
||
</a-card> | ||
|
||
<a-divider> 颜色反转 </a-divider> | ||
|
||
<a-card> | ||
|
||
<trend flag="up" :reverse-color="true" style="margin-right: 16px;"> | ||
<span slot="term">工资</span> | ||
5% | ||
</trend> | ||
<trend flag="down" :reverse-color="true" style="margin-right: 16px;"> | ||
<span slot="term">工作量</span> | ||
50% | ||
</trend> | ||
|
||
</a-card> | ||
|
||
<a-divider> 例子 </a-divider> | ||
|
||
</div> | ||
</template> | ||
|
||
<script> | ||
// @ is an alias to /src | ||
import HelloWorld from '@/components/HelloWorld.vue' | ||
// @ is an alias to /src | ||
export default { | ||
name: 'Home', | ||
components: { | ||
HelloWorld | ||
import Trend from '@/components/Trend' | ||
export default { | ||
name: 'Home', | ||
components: { | ||
Trend | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.home { | ||
width: 900px; | ||
margin: 0 auto; | ||
} | ||
.home > .banner { | ||
text-align: center; | ||
padding-top: 25px; | ||
margin: 25px 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters