refactor: popover to ts

feat-dayjs^2
Amour1688 2020-10-20 09:57:09 +08:00
parent 6b80eb72da
commit eb0688398f
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { inject } from 'vue'; import { App, defineComponent, inject } from 'vue';
import Tooltip from '../tooltip'; import Tooltip from '../tooltip';
import abstractTooltipProps from '../tooltip/abstractTooltipProps'; import abstractTooltipProps from '../tooltip/abstractTooltipProps';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
@ -6,7 +6,7 @@ import { getOptionProps, getComponent, getSlot } from '../_util/props-util';
import { defaultConfigProvider } from '../config-provider'; import { defaultConfigProvider } from '../config-provider';
const props = abstractTooltipProps(); const props = abstractTooltipProps();
const Popover = { const Popover = defineComponent({
name: 'APopover', name: 'APopover',
props: { props: {
...props, ...props,
@ -22,13 +22,13 @@ const Popover = {
}, },
methods: { methods: {
getPopupDomNode() { getPopupDomNode() {
return this.$refs.tooltip.getPopupDomNode(); return (this.$refs.tooltip as any).getPopupDomNode();
}, },
}, },
render() { render() {
const { title, prefixCls: customizePrefixCls, $slots } = this; const { title, prefixCls: customizePrefixCls, $slots } = this;
const getPrefixCls = this.configProvider.getPrefixCls; const { getPrefixCls } = this.configProvider;
const prefixCls = getPrefixCls('popover', customizePrefixCls); const prefixCls = getPrefixCls('popover', customizePrefixCls);
const props = getOptionProps(this); const props = getOptionProps(this);
@ -49,10 +49,10 @@ const Popover = {
}; };
return <Tooltip {...tooltipProps}>{getSlot(this)}</Tooltip>; return <Tooltip {...tooltipProps}>{getSlot(this)}</Tooltip>;
}, },
}; });
/* istanbul ignore next */ /* istanbul ignore next */
Popover.install = function(app) { Popover.install = function(app: App) {
app.component(Popover.name, Popover); app.component(Popover.name, Popover);
return app; return app;
}; };