|
|
@@ -1,4 +1,4 @@
|
|
|
-import { defineAsyncComponent, shallowRef, Ref } from 'vue'
|
|
|
+import { defineAsyncComponent, shallowRef, ref, Ref, toRaw } from 'vue'
|
|
|
import { OperationTabMenu, OperationTabMenuAuth } from '@/services/go/commonService/interface'
|
|
|
import { initData } from '@/common/methods'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
@@ -85,9 +85,9 @@ export function useMenu() {
|
|
|
*/
|
|
|
export function useDynamicComponent(menucode?: string) {
|
|
|
const { getChildrenMenu } = useMenu();
|
|
|
- const dynamicComponents: DynamicComponent[] = [];
|
|
|
- const currentAuth: BtnListType[] = []; // 当前操作权限
|
|
|
+ const dynamicComponents = ref<DynamicComponent[]>([]);
|
|
|
const currentTabComponent = shallowRef<DynamicComponent>(); // 当前选中的子组件
|
|
|
+ const currentAuth: BtnListType[] = []; // 当前操作权限
|
|
|
|
|
|
// 处理动态组件
|
|
|
const parseComponent = (items: OperationTabMenu[]) => {
|
|
|
@@ -130,7 +130,7 @@ export function useDynamicComponent(menucode?: string) {
|
|
|
|
|
|
// 切换组件
|
|
|
const componentChange = (component: DynamicComponent) => {
|
|
|
- currentTabComponent.value = component;
|
|
|
+ currentTabComponent.value = toRaw(component);
|
|
|
}
|
|
|
|
|
|
initData(() => {
|
|
|
@@ -149,7 +149,7 @@ export function useDynamicComponent(menucode?: string) {
|
|
|
}
|
|
|
if (children) {
|
|
|
const components = parseComponent(children);
|
|
|
- dynamicComponents.push(...components);
|
|
|
+ dynamicComponents.value.push(...components);
|
|
|
if (components.length) {
|
|
|
currentTabComponent.value = components[0];
|
|
|
}
|