mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] Panel: tsx (#2782)
This commit is contained in:
parent
7b238ed1e7
commit
ad27b885c9
@ -23,7 +23,7 @@ export type CellSlots = DefaultSlots & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type CellEvents = {
|
export type CellEvents = {
|
||||||
onClick(event: Event): void;
|
onClick?(event: Event): void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const [sfc, bem] = use('cell');
|
const [sfc, bem] = use('cell');
|
||||||
|
@ -3,9 +3,30 @@ import Cell from '../cell';
|
|||||||
import CellGroup from '../cell-group';
|
import CellGroup from '../cell-group';
|
||||||
import { inherit } from '../utils/functional';
|
import { inherit } from '../utils/functional';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { CreateElement, RenderContext } from 'vue/types';
|
||||||
|
import { ScopedSlot, DefaultSlots } from '../utils/use/sfc';
|
||||||
|
|
||||||
|
export type PanelProps = {
|
||||||
|
icon?: string;
|
||||||
|
desc?: string;
|
||||||
|
title?: string;
|
||||||
|
status?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PanelSlots = DefaultSlots & {
|
||||||
|
header?: ScopedSlot;
|
||||||
|
footer?: ScopedSlot;
|
||||||
|
};
|
||||||
|
|
||||||
const [sfc, bem] = use('panel');
|
const [sfc, bem] = use('panel');
|
||||||
|
|
||||||
function Panel(h, props, slots, ctx) {
|
function Panel(
|
||||||
|
h: CreateElement,
|
||||||
|
props: PanelProps,
|
||||||
|
slots: PanelSlots,
|
||||||
|
ctx: RenderContext<PanelProps>
|
||||||
|
) {
|
||||||
const Content = () => [
|
const Content = () => [
|
||||||
slots.header ? (
|
slots.header ? (
|
||||||
slots.header()
|
slots.header()
|
||||||
@ -41,4 +62,4 @@ Panel.props = {
|
|||||||
status: String
|
status: String
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sfc(Panel);
|
export default sfc<PanelProps>(Panel);
|
Loading…
x
Reference in New Issue
Block a user