Ver Fonte

feat(组件): 优化SmartPageProvider,解决transition动画不生效的问题

shizhongming há 2 anos atrás
pai
commit
987ed00c31

+ 1 - 1
src/components/SmartPageProvider/index.ts

@@ -1,4 +1,4 @@
-export { default as SmartPageProvider } from './src/SmartPageProvider.vue';
+export { default as SmartPageProvider } from './src/SmartPageProvider';
 
 export * from './src/constants';
 

+ 23 - 0
src/components/SmartPageProvider/src/SmartPageProvider.tsx

@@ -0,0 +1,23 @@
+import { type App, defineComponent } from 'vue';
+import { withInstall } from '@/utils';
+
+import { useProviderDict } from './hooks/useProviderDict';
+
+const SmartPageProvider = defineComponent({
+  name: 'SmartPageProvider',
+  setup(props, { slots }) {
+    useProviderDict();
+
+    return () => {
+      const children = slots.default?.();
+      return children && children[0];
+    };
+  },
+});
+
+SmartPageProvider.install = function (app: App) {
+  app.component(SmartPageProvider.name, SmartPageProvider);
+  return app;
+};
+
+export default withInstall(SmartPageProvider);

+ 0 - 11
src/components/SmartPageProvider/src/SmartPageProvider.vue

@@ -1,11 +0,0 @@
-<template>
-  <div class="full-height">
-    <slot></slot>
-  </div>
-</template>
-
-<script setup lang="ts">
-  import { useProviderDict } from './hooks/useProviderDict';
-
-  useProviderDict();
-</script>