perf: tsx use useExpose

This commit is contained in:
vben
2020-12-08 22:53:29 +08:00
parent 29461a8568
commit 9bb751475d
14 changed files with 63 additions and 55 deletions

View File

@@ -2,4 +2,10 @@
* copy from element-ui
*/
export { default as Scrollbar } from './src/Scrollbar';
import Scrollbar from './src/Scrollbar';
import { withInstall } from '../util';
withInstall(Scrollbar);
export { Scrollbar };
export type { ScrollbarType } from './src/types';

View File

@@ -15,8 +15,9 @@ import {
onBeforeUnmount,
} from 'vue';
import { getSlot } from '/@/utils/helper/tsxHelper';
import { tryTsxEmit } from '/@/utils/helper/vueHelper';
import './index.less';
import { useExpose } from '/@/hooks/core/useExpose';
import { ScrollbarType } from './types';
export default defineComponent({
name: 'Scrollbar',
@@ -65,10 +66,9 @@ export default defineComponent({
}
onMounted(() => {
tryTsxEmit<any>((instance) => {
instance.wrap = unref(wrapElRef);
useExpose<ScrollbarType>({
wrap: unref(wrapElRef),
});
const { native, noresize } = props;
const resizeEl = unref(resizeRef);
const warpEl = unref(wrapElRef);

View File

@@ -12,3 +12,7 @@ export interface BarMap {
vertical: BarMapItem;
horizontal: BarMapItem;
}
export interface ScrollbarType {
wrap: ElRef;
}