mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2025-09-11 06:29:21 +00:00
perf: remove unless code
This commit is contained in:
@@ -10,9 +10,11 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed } from 'vue';
|
||||
import { RightOutlined } from '@ant-design/icons-vue';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'BasicArrow',
|
||||
components: { RightOutlined },
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<script lang="ts">
|
||||
<script lang="tsx">
|
||||
import type { CSSProperties, PropType } from 'vue';
|
||||
import { defineComponent, computed, unref, h } from 'vue';
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
import { isString, isArray } from '/@/utils/is';
|
||||
import { getSlot } from '/@/utils/helper/tsxHelper';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'BasicHelp',
|
||||
components: { Tooltip },
|
||||
@@ -40,7 +42,7 @@
|
||||
setup(props, { slots }) {
|
||||
const { prefixCls } = useDesign('basic-help');
|
||||
|
||||
const getOverlayStyleRef = computed(
|
||||
const getOverlayStyle = computed(
|
||||
(): CSSProperties => {
|
||||
return {
|
||||
maxWidth: props.maxWidth,
|
||||
@@ -48,7 +50,7 @@
|
||||
}
|
||||
);
|
||||
|
||||
const getWrapStyleRef = computed(
|
||||
const getWrapStyle = computed(
|
||||
(): CSSProperties => {
|
||||
return {
|
||||
color: props.color,
|
||||
@@ -65,12 +67,19 @@
|
||||
const list = props.text;
|
||||
|
||||
if (isString(list)) {
|
||||
return h('p', list);
|
||||
return <p>{list}</p>;
|
||||
}
|
||||
|
||||
if (isArray(list)) {
|
||||
return list.map((item, index) => {
|
||||
return h('p', { key: item }, [props.showIndex ? `${index + 1}. ` : '', item]);
|
||||
return (
|
||||
<p key={item}>
|
||||
<>
|
||||
{props.showIndex ? `${index + 1}. ` : ''}
|
||||
{item}
|
||||
</>
|
||||
</p>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,34 +87,19 @@
|
||||
};
|
||||
|
||||
return () => {
|
||||
return h(
|
||||
// @ts-ignores
|
||||
Tooltip,
|
||||
{
|
||||
title: h(
|
||||
'div',
|
||||
{
|
||||
style: unref(getWrapStyleRef),
|
||||
},
|
||||
[renderTitle()]
|
||||
),
|
||||
overlayClassName: `${prefixCls}__wrap`,
|
||||
autoAdjustOverflow: true,
|
||||
overlayStyle: unref(getOverlayStyleRef),
|
||||
placement: props.placement,
|
||||
getPopupContainer: () => getPopupContainer(),
|
||||
},
|
||||
{
|
||||
default: () =>
|
||||
h(
|
||||
'span',
|
||||
{
|
||||
class: prefixCls,
|
||||
style: unref(getMainStyleRef),
|
||||
},
|
||||
getSlot(slots) || h(InfoCircleOutlined)
|
||||
),
|
||||
}
|
||||
return (
|
||||
<Tooltip
|
||||
title={<div style={unref(getWrapStyle)}>{renderTitle()}</div>}
|
||||
overlayClassName={`${prefixCls}__wrap`}
|
||||
autoAdjustOverflow={true}
|
||||
overlayStyle={unref(getOverlayStyle)}
|
||||
placement={props.placement as 'left'}
|
||||
getPopupContainer={() => getPopupContainer()}
|
||||
>
|
||||
<span class={prefixCls} style={unref(getMainStyleRef)}>
|
||||
{getSlot(slots) || <InfoCircleOutlined />}
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
},
|
||||
|
@@ -8,11 +8,12 @@
|
||||
import type { PropType } from 'vue';
|
||||
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
import BasicHelp from './BasicHelp.vue';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'BasicTitle',
|
||||
components: { BasicHelp },
|
||||
|
Reference in New Issue
Block a user