fix: functional compoent support vue3.0.3

pull/3271/head
tanjinzhou 4 years ago
parent fa320e6e64
commit f5cf7e0920

@ -1,4 +1,4 @@
import { CSSProperties, VNodeTypes, inject, SetupContext, FunctionalComponent } from 'vue'; import { CSSProperties, VNodeTypes, inject, FunctionalComponent } from 'vue';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
import { defaultConfigProvider } from '../config-provider'; import { defaultConfigProvider } from '../config-provider';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
@ -30,7 +30,7 @@ interface EmptyType extends FunctionalComponent<EmptyProps> {
PRESENTED_IMAGE_SIMPLE: VNodeTypes; PRESENTED_IMAGE_SIMPLE: VNodeTypes;
} }
const Empty: EmptyType = (props: EmptyProps, { slots = {}, attrs }: SetupContext) => { const Empty: EmptyType = (props, { slots = {}, attrs }) => {
const configProvider = inject('configProvider', defaultConfigProvider); const configProvider = inject('configProvider', defaultConfigProvider);
const { getPrefixCls, direction } = configProvider; const { getPrefixCls, direction } = configProvider;
const { const {

@ -1,4 +1,4 @@
import { SetupContext, VNodeChild } from 'vue'; import { FunctionalComponent, VNodeChild } from 'vue';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
export interface TransBtnProps { export interface TransBtnProps {
@ -9,7 +9,11 @@ export interface TransBtnProps {
onClick?: (payload: MouseEvent) => void; onClick?: (payload: MouseEvent) => void;
} }
const TransBtn = (props: TransBtnProps, { slots }: SetupContext) => { export interface TransBtnType extends FunctionalComponent<TransBtnProps> {
displayName: string;
}
const TransBtn: TransBtnType = (props, { slots }) => {
const { class: className, customizeIcon, customizeIconProps, onMousedown, onClick } = props; const { class: className, customizeIcon, customizeIconProps, onMousedown, onClick } = props;
let icon: VNodeChild; let icon: VNodeChild;
@ -48,6 +52,7 @@ const TransBtn = (props: TransBtnProps, { slots }: SetupContext) => {
}; };
TransBtn.inheritAttrs = false; TransBtn.inheritAttrs = false;
TransBtn.displayName = 'TransBtn';
TransBtn.props = { TransBtn.props = {
class: PropTypes.string, class: PropTypes.string,
customizeIcon: PropTypes.any, customizeIcon: PropTypes.any,

Loading…
Cancel
Save