mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 19:29:04 +08:00
perf: tsx use useExpose
This commit is contained in:
@@ -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';
|
||||
|
@@ -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);
|
||||
|
4
src/components/Scrollbar/src/types.d.ts
vendored
4
src/components/Scrollbar/src/types.d.ts
vendored
@@ -12,3 +12,7 @@ export interface BarMap {
|
||||
vertical: BarMapItem;
|
||||
horizontal: BarMapItem;
|
||||
}
|
||||
|
||||
export interface ScrollbarType {
|
||||
wrap: ElRef;
|
||||
}
|
||||
|
Reference in New Issue
Block a user