mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 11:17:41 +00:00
[improvement] optimize sfc type definitions (#2778)
This commit is contained in:
@@ -2,11 +2,21 @@ import { use, isDef } from '../utils';
|
||||
import { inherit } from '../utils/functional';
|
||||
|
||||
// Types
|
||||
import { FunctionalComponent } from '../utils/use/sfc';
|
||||
import { CreateElement, RenderContext } from 'vue/types';
|
||||
import { DefaultSlots } from '../utils/use/sfc';
|
||||
|
||||
export type InfoProps = {
|
||||
info?: string | number;
|
||||
};
|
||||
|
||||
const [sfc, bem] = use('info');
|
||||
|
||||
const Info: FunctionalComponent<InfoProps> = function (h, props, slots, ctx) {
|
||||
function Info(
|
||||
h: CreateElement,
|
||||
props: InfoProps,
|
||||
slots: DefaultSlots,
|
||||
ctx: RenderContext<InfoProps>
|
||||
) {
|
||||
if (!isDef(props.info)) {
|
||||
return;
|
||||
}
|
||||
@@ -16,11 +26,7 @@ const Info: FunctionalComponent<InfoProps> = function (h, props, slots, ctx) {
|
||||
{props.info}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export type InfoProps = {
|
||||
info?: string | number;
|
||||
};
|
||||
}
|
||||
|
||||
Info.props = {
|
||||
info: [String, Number]
|
||||
|
Reference in New Issue
Block a user