mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] ContactCard: tsx (#2783)
This commit is contained in:
parent
ad27b885c9
commit
f211afe714
@ -23,6 +23,10 @@ export type ButtonProps = RouteProps & {
|
|||||||
bottomAction?: boolean;
|
bottomAction?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ButtonEvents = {
|
||||||
|
onClick?(event: Event): void;
|
||||||
|
};
|
||||||
|
|
||||||
const [sfc, bem] = use('button');
|
const [sfc, bem] = use('button');
|
||||||
|
|
||||||
function Button(
|
function Button(
|
||||||
@ -100,4 +104,4 @@ Button.props = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sfc<ButtonProps>(Button);
|
export default sfc<ButtonProps, ButtonEvents>(Button);
|
||||||
|
@ -32,6 +32,10 @@ export type CardSlots = DefaultSlots & {
|
|||||||
'origin-price'?: ScopedSlot;
|
'origin-price'?: ScopedSlot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type CardEvents = {
|
||||||
|
onClick?(event: Event): void;
|
||||||
|
};
|
||||||
|
|
||||||
const [sfc, bem] = use('card');
|
const [sfc, bem] = use('card');
|
||||||
|
|
||||||
function Card(
|
function Card(
|
||||||
@ -140,4 +144,4 @@ Card.props = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sfc<CardProps>(Card);
|
export default sfc<CardProps, CardEvents>(Card);
|
||||||
|
@ -140,6 +140,12 @@ export default {
|
|||||||
| tel | Phone | `String` | - |
|
| tel | Phone | `String` | - |
|
||||||
| add-text | Add card text | `String` | `Add contact info` |
|
| add-text | Add card text | `String` | `Add contact info` |
|
||||||
|
|
||||||
|
### ContactCard Event
|
||||||
|
|
||||||
|
| Event | Description | Arguments |
|
||||||
|
|------|------|------|
|
||||||
|
| click | Triggered when clicked | - |
|
||||||
|
|
||||||
### ContactList API
|
### ContactList API
|
||||||
|
|
||||||
| Attribute | Description | Type | Default |
|
| Attribute | Description | Type | Default |
|
||||||
|
@ -140,6 +140,12 @@ export default {
|
|||||||
| tel | 联系人手机号 | `String` | - | - |
|
| tel | 联系人手机号 | `String` | - | - |
|
||||||
| add-text | 添加时的文案提示 | `String` | `添加订单联系人信息` | - |
|
| add-text | 添加时的文案提示 | `String` | `添加订单联系人信息` | - |
|
||||||
|
|
||||||
|
### ContactCard Event
|
||||||
|
|
||||||
|
| 事件名 | 说明 | 参数 |
|
||||||
|
|------|------|------|
|
||||||
|
| click | 点击时触发 | - |
|
||||||
|
|
||||||
### ContactList API
|
### ContactList API
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||||
|
@ -138,6 +138,7 @@ Field support all native events of input tag,such as `focus`、`blur`、`keypr
|
|||||||
|
|
||||||
| Event | Description | Parameters |
|
| Event | Description | Parameters |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
|
| input | Triggered when value changed | - |
|
||||||
| clear | Triggered when click clear icon | - |
|
| clear | Triggered when click clear icon | - |
|
||||||
| click-left-icon | Triggered when click the left icon of Field | - |
|
| click-left-icon | Triggered when click the left icon of Field | - |
|
||||||
| click-right-icon | Triggered when click the right icon of Field | - |
|
| click-right-icon | Triggered when click the right icon of Field | - |
|
||||||
|
@ -140,6 +140,7 @@ Field 默认支持 Input 标签所有的原生事件,如 `focus`、`blur`、`k
|
|||||||
|
|
||||||
| 事件 | 说明 | 回调参数 |
|
| 事件 | 说明 | 回调参数 |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
|
| input | 输入框内容变化时触发 | - |
|
||||||
| clear | 点击清除按钮后触发 | - |
|
| clear | 点击清除按钮后触发 | - |
|
||||||
| click-left-icon | 点击头部图标时触发 | - |
|
| click-left-icon | 点击头部图标时触发 | - |
|
||||||
| click-right-icon | 点击尾部图标时触发 | - |
|
| click-right-icon | 点击尾部图标时触发 | - |
|
||||||
|
@ -2,9 +2,39 @@ import { use, noop } from '../utils';
|
|||||||
import { inherit } from '../utils/functional';
|
import { inherit } from '../utils/functional';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { CreateElement, RenderContext } from 'vue/types';
|
||||||
|
import { ScopedSlot, DefaultSlots } from '../utils/use/sfc';
|
||||||
|
|
||||||
|
export type NavBarProps = {
|
||||||
|
title?: string;
|
||||||
|
fixed?: boolean;
|
||||||
|
zIndex?: number;
|
||||||
|
border?: boolean;
|
||||||
|
leftText?: string;
|
||||||
|
rightText?: string;
|
||||||
|
leftArrow?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NavBarSlots = DefaultSlots & {
|
||||||
|
left?: ScopedSlot;
|
||||||
|
title?: ScopedSlot;
|
||||||
|
right?: ScopedSlot;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NavBarEvents = {
|
||||||
|
'click-left'?(event: Event): void;
|
||||||
|
'click-right'?(event: Event): void;
|
||||||
|
};
|
||||||
|
|
||||||
const [sfc, bem] = use('nav-bar');
|
const [sfc, bem] = use('nav-bar');
|
||||||
|
|
||||||
function NavBar(h, props, slots, ctx) {
|
function NavBar(
|
||||||
|
h: CreateElement,
|
||||||
|
props: NavBarProps,
|
||||||
|
slots: NavBarSlots,
|
||||||
|
ctx: RenderContext<NavBarProps>
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
@ -56,4 +86,4 @@ NavBar.props = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sfc(NavBar);
|
export default sfc<NavBarProps, NavBarEvents>(NavBar);
|
Loading…
x
Reference in New Issue
Block a user