[breaking change] GoodsAction: rename component

This commit is contained in:
陈嘉涵
2019-04-29 16:40:50 +08:00
parent 706f047909
commit 138790b3e3
13 changed files with 114 additions and 114 deletions
+28
View File
@@ -0,0 +1,28 @@
@import '../style/var';
.van-goods-action-icon {
color: @gray-darker;
display: flex;
height: 50px;
font-size: 10px;
min-width: 15%;
line-height: 1;
text-align: center;
background-color: @white;
flex-direction: column;
justify-content: center;
&:not(:first-child)::after {
border-left-width: 1px;
}
&:active {
background-color: @active-color;
}
&__icon {
width: 1em;
font-size: 20px;
margin: 0 auto 5px;
}
}
+51
View File
@@ -0,0 +1,51 @@
import { use } from '../utils';
import Icon, { IconEvents } from '../icon';
import { emit, inherit } from '../utils/functional';
import { functionalRoute, routeProps, RouteProps } from '../utils/router';
// Types
import { CreateElement, RenderContext } from 'vue/types';
import { DefaultSlots } from '../utils/use/sfc';
export type GoodsActionIconProps = RouteProps & {
icon: string;
text?: string;
info?: string | number;
iconClass?: any;
};
const [sfc, bem] = use('goods-action-icon');
function GoodsActionIcon(
h: CreateElement,
props: GoodsActionIconProps,
slots: DefaultSlots,
ctx: RenderContext<GoodsActionIconProps>
) {
const onClick = (event: Event) => {
emit(ctx, 'click', event);
functionalRoute(ctx);
};
return (
<div class={[bem(), 'van-hairline']} onClick={onClick} {...inherit(ctx)}>
<Icon
class={[bem('icon'), props.iconClass]}
tag="div"
info={props.info}
name={props.icon}
/>
{slots.default ? slots.default() : props.text}
</div>
);
}
GoodsActionIcon.props = {
...routeProps,
text: String,
icon: String,
info: [String, Number],
iconClass: null as any
};
export default sfc<GoodsActionIconProps, IconEvents>(GoodsActionIcon);