mirror of
https://gitcode.com/gh_mirrors/vue/vue-vben-admin
synced 2026-05-22 21:57:46 +00:00
wip(table): perf table #136,146,134
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Button from './src/BasicButton.vue';
|
||||
import PopConfirmButton from './src/PopConfirmButton.vue';
|
||||
import { withInstall } from '../util';
|
||||
|
||||
withInstall(Button);
|
||||
export { Button };
|
||||
withInstall(Button, PopConfirmButton);
|
||||
export { Button, PopConfirmButton };
|
||||
|
||||
34
src/components/Button/src/PopConfirmButton.vue
Normal file
34
src/components/Button/src/PopConfirmButton.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, h, unref } from 'vue';
|
||||
|
||||
import { Popconfirm } from 'ant-design-vue';
|
||||
import BasicButton from './BasicButton.vue';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { extendSlots } from '/@/utils/helper/tsxHelper';
|
||||
import { omit } from 'lodash-es';
|
||||
const { t } = useI18n();
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PopButton',
|
||||
inheritAttrs: false,
|
||||
components: { Popconfirm, BasicButton },
|
||||
props: {
|
||||
enable: propTypes.bool.def(true),
|
||||
okText: propTypes.string.def(t('component.drawer.okText')),
|
||||
cancelText: propTypes.string.def(t('component.drawer.cancelText')),
|
||||
},
|
||||
setup(props, { slots, attrs }) {
|
||||
return () => {
|
||||
const popValues = { ...props, ...unref(attrs) };
|
||||
|
||||
const Button = h(BasicButton, omit(unref(attrs), 'icon'), extendSlots(slots));
|
||||
if (!props.enable) {
|
||||
return Button;
|
||||
}
|
||||
|
||||
return h(Popconfirm, omit(popValues, 'icon'), { default: () => Button });
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user